From 0856a9fa811204b636ac1e26f9e674c1d7a841f7 Mon Sep 17 00:00:00 2001 From: Jeremy Latt Date: Sun, 23 Feb 2014 17:16:35 -0800 Subject: [PATCH] flag socket as closed when writes fail --- irc/socket.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/irc/socket.go b/irc/socket.go index 767b7d30..93f76166 100644 --- a/irc/socket.go +++ b/irc/socket.go @@ -60,6 +60,7 @@ func (socket *Socket) readLines(commands chan<- Command) { for { line, err := socket.reader.ReadString('\n') if socket.isError(err, R) { + socket.closed = true break } line = strings.TrimRight(line, "\r\n") @@ -91,14 +92,17 @@ func (socket *Socket) Write(line string) (err error) { return io.EOF } if _, err = socket.writer.WriteString(line); socket.isError(err, W) { + socket.closed = true return } if _, err = socket.writer.WriteString(CRLF); socket.isError(err, W) { + socket.closed = true return } if err = socket.writer.Flush(); socket.isError(err, W) { + socket.closed = true return }