From d0fa3918ec175ef1fd5da0fc1a492a0ac651cddc Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Mon, 27 Apr 2015 10:58:49 -0700 Subject: [PATCH] NewTicker -> NewTimer, to fix a memory leak --- p2p/connection.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/p2p/connection.go b/p2p/connection.go index d1b6390a2..919f71aa9 100644 --- a/p2p/connection.go +++ b/p2p/connection.go @@ -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: