Improve IRC connection handling

This commit is contained in:
Ken-Håvard Lieng 2016-01-13 00:12:51 +01:00
parent 6f9f3cff95
commit c22b7d2a1d
6 changed files with 311 additions and 14 deletions

View file

@ -31,6 +31,7 @@ type Client struct {
quit chan struct{}
reconnect chan struct{}
ready sync.WaitGroup
sendRecv sync.WaitGroup
once resync.Once
lock sync.Mutex
}
@ -83,11 +84,6 @@ func (c *Client) Quit() {
c.write("QUIT")
}
close(c.quit)
c.lock.Lock()
if c.conn != nil {
c.conn.Close()
}
c.lock.Unlock()
}()
}