summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/peer.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/server/peer.go b/server/peer.go
index 226f21d1..ff85ad28 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -191,7 +191,15 @@ func (peer *Peer) startFSMHandler(incoming chan *fsmMsg) {
}
func (peer *Peer) PassConn(conn *net.TCPConn) {
- peer.fsm.connCh <- conn
+ select {
+ case peer.fsm.connCh <- conn:
+ default:
+ conn.Close()
+ log.WithFields(log.Fields{
+ "Topic": "Peer",
+ "Key": peer.config.NeighborAddress,
+ }).Warn("accepted conn is closed to avoid be blocked")
+ }
}
func (peer *Peer) MarshalJSON() ([]byte, error) {