mirror of
https://github.com/asmogo/nws.git
synced 2025-01-18 18:11:33 +00:00
removed unwanted connection object. added comment.
This commit is contained in:
parent
9cfbd2329d
commit
36cc5eca25
@ -208,18 +208,16 @@ func (s *Server) handleConnect(ctx context.Context, conn net.Conn, req *Request)
|
|||||||
return fmt.Errorf("failed to send reply: %v", err)
|
return fmt.Errorf("failed to send reply: %v", err)
|
||||||
}
|
}
|
||||||
// read
|
// read
|
||||||
var connR net.Conn
|
|
||||||
if options.MessageType == protocol.MessageConnectReverse {
|
if options.MessageType == protocol.MessageConnectReverse {
|
||||||
// wait for the connection
|
// wait for the connection
|
||||||
connR = <-ch
|
// in this case, our target needs to be the reversed tcp connection
|
||||||
defer connR.Close()
|
target = <-ch
|
||||||
} else {
|
defer target.Close()
|
||||||
connR = target
|
|
||||||
}
|
}
|
||||||
// Start proxying
|
// Start proxying
|
||||||
errCh := make(chan error, 2)
|
errCh := make(chan error, 2)
|
||||||
go Proxy(connR, conn, errCh)
|
go Proxy(target, conn, errCh)
|
||||||
go Proxy(conn, connR, errCh)
|
go Proxy(conn, target, errCh)
|
||||||
|
|
||||||
// Wait
|
// Wait
|
||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
|
Loading…
Reference in New Issue
Block a user