Browse Source

NewTicker -> NewTimer, to fix a memory leak

pull/67/head
Jae Kwon 9 years ago
parent
commit
d0fa3918ec
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      p2p/connection.go

+ 2
- 2
p2p/connection.go View File

@ -487,9 +487,9 @@ func newChannel(conn *MConnection, desc *ChannelDescriptor) *Channel {
// Goroutine-safe
// Times out (and returns false) after defaultSendTimeoutSeconds
func (ch *Channel) sendBytes(bytes []byte) bool {
sendTicker := time.NewTicker(defaultSendTimeoutSeconds * time.Second)
timeout := time.NewTimer(defaultSendTimeoutSeconds * time.Second)
select {
case <-sendTicker.C:
case <-timeout.C:
// timeout
return false
case ch.sendQueue <- bytes:


Loading…
Cancel
Save