OSDN Git Service
(root)
/
bytom
/
bytom.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c108d60
)
edit for code review
author
paladz
<453256728@qq.com>
Wed, 30 May 2018 09:04:18 +0000
(17:04 +0800)
committer
paladz
<453256728@qq.com>
Wed, 30 May 2018 09:04:18 +0000
(17:04 +0800)
p2p/connection/connection.go
patch
|
blob
|
history
diff --git
a/p2p/connection/connection.go
b/p2p/connection/connection.go
index
09b2810
..
983fe22
100644
(file)
--- a/
p2p/connection/connection.go
+++ b/
p2p/connection/connection.go
@@
-118,7
+118,7
@@
func NewMConnectionWithConfig(conn net.Conn, chDescs []*ChannelDescriptor, onRec
sendMonitor: flow.New(0, 0),
recvMonitor: flow.New(0, 0),
send: make(chan struct{}, 1),
- pong: make(chan struct{}),
+ pong: make(chan struct{}
, 1
),
channelsIdx: map[byte]*channel{},
channels: []*channel{},
onReceive: onReceive,
@@
-268,7
+268,10
@@
func (c *MConnection) recvRoutine() {
switch pktType {
case packetTypePing:
log.Debug("receive Ping")
- c.pong <- struct{}{}
+ select {
+ case c.pong <- struct{}{}:
+ default:
+ }
case packetTypePong:
log.Debug("receive Pong")