Skip to content

Commit

Permalink
Fix received connection not closing
Browse files Browse the repository at this point in the history
Signed-off-by: Yilun <[email protected]>
  • Loading branch information
yilunzhang committed Sep 6, 2018
1 parent c96eb17 commit 0be60e0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions net/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ func NewNode() *node {
state: INIT,
}
n.time = time.Now()
go func() {
time.Sleep(ConnectingTimeout)
if n.local != &n && n.GetState() != ESTABLISH {
log.Warn("Connecting timeout:", n.GetAddrStr())
n.SetState(INACTIVITY)
n.CloseConn()
}
}()
return &n
}

Expand Down

0 comments on commit 0be60e0

Please sign in to comment.