ircevent: allow send calls before first connect

This commit is contained in:
Shivaram Lingamneni 2021-07-23 16:13:04 -04:00
parent 256f1601d3
commit 9f427b3fd4

@ -336,10 +336,15 @@ func (irc *Connection) sendInternal(b []byte) (err error) {
// `end` is closed), but invocations from outside do (even though the race window
// is very small).
irc.stateMutex.Lock()
running := irc.running
end := irc.end
pwrite := irc.pwrite
irc.stateMutex.Unlock()
if !running {
return ClientDisconnected
}
select {
case pwrite <- b:
return nil