Set TCP socket options before upgrading connection

This commit is contained in:
Neil Alexander 2019-10-23 18:24:08 +01:00
parent 6a22e6c9de
commit cd77727c1e
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -355,6 +355,7 @@ func (t *tcp) call(saddr string, options interface{}, sintf string, upgrade *Tcp
func (t *tcp) handler(sock net.Conn, incoming bool, options interface{}, upgrade *TcpUpgrade) { func (t *tcp) handler(sock net.Conn, incoming bool, options interface{}, upgrade *TcpUpgrade) {
defer t.waitgroup.Done() // Happens after sock.close defer t.waitgroup.Done() // Happens after sock.close
defer sock.Close() defer sock.Close()
t.setExtraOptions(sock)
var upgraded bool var upgraded bool
if upgrade != nil { if upgrade != nil {
var err error var err error
@ -365,7 +366,6 @@ func (t *tcp) handler(sock net.Conn, incoming bool, options interface{}, upgrade
upgraded = true upgraded = true
} }
} }
t.setExtraOptions(sock)
stream := stream{} stream := stream{}
stream.init(sock) stream.init(sock)
var name, proto, local, remote string var name, proto, local, remote string