dev-tunnels icon indicating copy to clipboard operation
dev-tunnels copied to clipboard

`RefreshPorts` code path doesn't really make sense

Open williammartin opened this issue 9 months ago • 1 comments

Description

Someone shared this error log for gh cs ssh (used to connect to GitHub codespaces over ssh):

kex_exchange_identification: read: Connection reset by peer
Connection reset by 127.0.0.1 port 65225
tunnel closed: error forwarding port: refresh ports failed: failed to refresh ports: %!w(<nil>)

Looking at the code where this error is returned, there doesn't appear to be any case in which the error will be non-nil:

https://github.com/microsoft/dev-tunnels/blob/845d75c554514d34c6cd80de23ec6d616a674d47/go/tunnels/client.go#L210-L219

I have no opinion on what the message should say. Happy to open a PR with your recommendation.


Separately, as a minor nit reading this code, it seems like it would be better for the final return on this method to be return nil, since again, no other value is possible.

williammartin avatar Jan 21 '25 11:01 williammartin