tiny refactor: inline a tiny single-use fun and move another
This commit is contained in:
1 parent
4e34f2001c
commit
7a5c910cd5
2 files changed
+10
-14
No files matched your search
+3
-14
@@ -379,7 +379,9 @@ func (conn *LocalConnection) shutdown(err error) {
|
|||||||
conn.Router.Ourself.DeleteConnection(conn)
|
conn.Router.Ourself.DeleteConnection(conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
stopTicker(conn.heartbeatTCP)
|
if conn.heartbeatTCP != nil {
|
||||||
|
conn.heartbeatTCP.Stop()
|
||||||
|
}
|
||||||
|
|
||||||
if conn.forwarder != nil {
|
if conn.forwarder != nil {
|
||||||
conn.forwarder.Stop()
|
conn.forwarder.Stop()
|
||||||
@@ -451,16 +453,3 @@ func (conn *LocalConnection) handleProtocolMsg(tag ProtocolTag, payload []byte)
|
|||||||
func (conn *LocalConnection) extendReadDeadline() {
|
func (conn *LocalConnection) extendReadDeadline() {
|
||||||
conn.TCPConn.SetReadDeadline(time.Now().Add(TCPHeartbeat * 2))
|
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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1126,3 +1126,10 @@ func timerChan(timer *time.Timer) <-chan time.Time {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func tickerChan(ticker *time.Ticker) <-chan time.Time {
|
||||||
|
if ticker != nil {
|
||||||
|
return ticker.C
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
Reference in new issue
Block a user