mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-07 08:07:42 +00:00
derp: don't start sending keepalives to client until after serverInfo sent
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
1155716318
commit
79af6054bf
@ -122,16 +122,11 @@ func (s *Server) accept(nc net.Conn, brw *bufio.ReadWriter) error {
|
|||||||
if clientInfo != nil {
|
if clientInfo != nil {
|
||||||
c.info = *clientInfo
|
c.info = *clientInfo
|
||||||
}
|
}
|
||||||
go func() {
|
|
||||||
if err := c.keepAlive(ctx); err != nil {
|
|
||||||
s.logf("derp: %s: client %x: keep alive failed: %v", nc.RemoteAddr(), c.key, err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
curClient := s.clients[c.key]
|
curClient := s.clients[c.key]
|
||||||
if curClient != nil && curClient.nc == nc {
|
if curClient == c {
|
||||||
s.logf("derp: %s: client %x: removing connection", nc.RemoteAddr(), c.key)
|
s.logf("derp: %s: client %x: removing connection", nc.RemoteAddr(), c.key)
|
||||||
delete(s.clients, c.key)
|
delete(s.clients, c.key)
|
||||||
}
|
}
|
||||||
@ -159,6 +154,12 @@ func (s *Server) accept(nc net.Conn, brw *bufio.ReadWriter) error {
|
|||||||
s.logf("derp: %s: client %x: adding connection, replacing %s", nc.RemoteAddr(), c.key, oldClient.nc.RemoteAddr())
|
s.logf("derp: %s: client %x: adding connection, replacing %s", nc.RemoteAddr(), c.key, oldClient.nc.RemoteAddr())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
if err := c.keepAlive(ctx); err != nil {
|
||||||
|
s.logf("derp: %s: client %x: keep alive failed: %v", nc.RemoteAddr(), c.key, err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
dstKey, contents, err := s.recvPacket(c.br)
|
dstKey, contents, err := s.recvPacket(c.br)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user