Update lrstanley/girc dep (#1773)
This commit is contained in:
10
vendor/github.com/lrstanley/girc/conn.go
generated
vendored
10
vendor/github.com/lrstanley/girc/conn.go
generated
vendored
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user