TUN-5184: Handle errors in bidrectional streaming (websocket#Stream) gracefully when 1 side has ended

This commit is contained in:
Nuno Diegues
2022-02-10 12:59:15 +00:00
parent db01127191
commit ff4cfeda0c
2 changed files with 54 additions and 30 deletions

View File

@@ -78,16 +78,3 @@ func (sp *socksProxyOverWSConnection) Stream(ctx context.Context, tunnelConn io.
func (sp *socksProxyOverWSConnection) Close() {
}
// wsProxyConnection represents a bidirectional stream for a websocket connection to the origin
type wsProxyConnection struct {
rwc io.ReadWriteCloser
}
func (conn *wsProxyConnection) Stream(ctx context.Context, tunnelConn io.ReadWriter, log *zerolog.Logger) {
websocket.Stream(tunnelConn, conn.rwc, log)
}
func (conn *wsProxyConnection) Close() {
conn.rwc.Close()
}