From 5f268e4847697db398f9e26d7e22f3b6f85c2834 Mon Sep 17 00:00:00 2001 From: Jeremy Latt Date: Thu, 27 Mar 2014 14:43:52 -0700 Subject: [PATCH] async all write buffer flushes --- irc/socket.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/irc/socket.go b/irc/socket.go index 84e90313..4f3f94dc 100644 --- a/irc/socket.go +++ b/irc/socket.go @@ -78,14 +78,16 @@ func (socket *Socket) Write(line string) (err error) { return } - if err = socket.writer.Flush(); socket.isError(err, W) { - return - } + go socket.flush() Log.debug.Printf("%s ← %s", socket, line) return } +func (socket *Socket) flush() { + socket.isError(socket.writer.Flush(), W) +} + func (socket *Socket) isError(err error, dir rune) bool { if err != nil { if err != io.EOF {