3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 18:52:41 +01:00

Merge pull request #33 from jlatt/async-write-flush

async all write buffer flushes
This commit is contained in:
Jeremy Latt 2014-03-28 14:34:37 -07:00
commit 2d2e63a1b7

View File

@ -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 {