Document functions safe to call from any goroutine
This commit is contained in:
parent
1c3da31f2e
commit
2ae43be525
@ -306,15 +306,17 @@ func (dc *downstreamConn) writeMessages() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close closes the connection. It is safe to call from any goroutine.
|
||||
func (dc *downstreamConn) Close() error {
|
||||
if dc.isClosed() {
|
||||
return fmt.Errorf("downstream connection already closed")
|
||||
}
|
||||
|
||||
close(dc.closed)
|
||||
return nil
|
||||
}
|
||||
|
||||
// SendMessage queues a new outgoing message. It is safe to call from any
|
||||
// goroutine.
|
||||
func (dc *downstreamConn) SendMessage(msg *irc.Message) {
|
||||
dc.outgoing <- msg
|
||||
}
|
||||
|
@ -145,6 +145,7 @@ func (uc *upstreamConn) isClosed() bool {
|
||||
}
|
||||
}
|
||||
|
||||
// Close closes the connection. It is safe to call from any goroutine.
|
||||
func (uc *upstreamConn) Close() error {
|
||||
if uc.isClosed() {
|
||||
return fmt.Errorf("upstream connection already closed")
|
||||
@ -1391,6 +1392,8 @@ func (uc *upstreamConn) readMessages(ch chan<- event) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SendMessage queues a new outgoing message. It is safe to call from any
|
||||
// goroutine.
|
||||
func (uc *upstreamConn) SendMessage(msg *irc.Message) {
|
||||
uc.outgoing <- msg
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user