diff options
Diffstat (limited to 'vendor/github.com/lrstanley/girc/conn.go')
-rw-r--r-- | vendor/github.com/lrstanley/girc/conn.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/vendor/github.com/lrstanley/girc/conn.go b/vendor/github.com/lrstanley/girc/conn.go index 441c3e71..b691403c 100644 --- a/vendor/github.com/lrstanley/girc/conn.go +++ b/vendor/github.com/lrstanley/girc/conn.go @@ -43,8 +43,7 @@ type ircConn struct { lastPing time.Time // lastPong is the last successful time that we pinged the server and // received a successful pong back. - lastPong time.Time - pingDelay time.Duration + lastPong time.Time } // Dialer is an interface implementation of net.Dialer. Use this if you would @@ -477,7 +476,7 @@ func (c *Client) write(event *Event) { func (c *ircConn) rate(chars int) time.Duration { _time := time.Second + ((time.Duration(chars) * time.Second) / 100) - if c.writeDelay += _time - time.Now().Sub(c.lastWrite); c.writeDelay < 0 { + if c.writeDelay += _time - time.Since(c.lastWrite); c.writeDelay < 0 { c.writeDelay = 0 } @@ -607,15 +606,16 @@ func (c *Client) pingLoop(ctx context.Context, errs chan error, wg *sync.WaitGro if time.Since(c.conn.lastPong) > c.Config.PingDelay+(60*time.Second) { // It's 60 seconds over what out ping delay is, connection // has probably dropped. - errs <- ErrTimedOut{ + err := ErrTimedOut{ TimeSinceSuccess: time.Since(c.conn.lastPong), LastPong: c.conn.lastPong, LastPing: c.conn.lastPing, Delay: c.Config.PingDelay, } - wg.Done() c.conn.mu.RUnlock() + errs <- err + wg.Done() return } c.conn.mu.RUnlock() |