Skip to content

Commit

Permalink
fix: close connection after failed handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
Musixal committed Oct 7, 2024
1 parent 0585927 commit 79de2dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/server/transport/tcpmux.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,14 @@ func (s *TcpMuxTransport) channelHandshake() {

if msg != s.config.Token {
s.logger.Warnf("invalid security token received: %s", msg)
conn.Close()
continue
}

err = utils.SendBinaryString(conn, s.config.Token)
if err != nil {
s.logger.Errorf("failed to send security token: %v", err)
conn.Close()
continue
}

Expand Down Expand Up @@ -256,7 +258,6 @@ func (s *TcpMuxTransport) acceptTunnelConn(listener net.Listener) {
for {
select {
case <-s.ctx.Done():
close(s.tunnelChannel)
return
default:
s.logger.Debugf("waiting for accept incoming tunnel connection on %s", listener.Addr().String())
Expand Down

0 comments on commit 79de2dd

Please sign in to comment.