tiny refactor: inline a tiny single-use fun and move another

This commit is contained in:
Matthias Radestock committed 2015-11-07 12:44:13 +00:00
1 parent 4e34f2001c
commit 7a5c910cd5
2 files changed
+10 -14

No files matched your search

+3 -14
View File
@@ -379,7 +379,9 @@ func (conn *LocalConnection) shutdown(err error) {
conn.Router.Ourself.DeleteConnection(conn)
}
stopTicker(conn.heartbeatTCP)
if conn.heartbeatTCP != nil {
conn.heartbeatTCP.Stop()
}
if conn.forwarder != nil {
conn.forwarder.Stop()
@@ -451,16 +453,3 @@ func (conn *LocalConnection) handleProtocolMsg(tag ProtocolTag, payload []byte)
func (conn *LocalConnection) extendReadDeadline() {
conn.TCPConn.SetReadDeadline(time.Now().Add(TCPHeartbeat * 2))
}
func tickerChan(ticker *time.Ticker) <-chan time.Time {
if ticker != nil {
return ticker.C
}
return nil
}
func stopTicker(ticker *time.Ticker) {
if ticker != nil {
ticker.Stop()
}
}
+7
View File
@@ -1126,3 +1126,10 @@ func timerChan(timer *time.Timer) <-chan time.Time {
}
return nil
}
func tickerChan(ticker *time.Ticker) <-chan time.Time {
if ticker != nil {
return ticker.C
}
return nil
}