forked from External/ergo
async all write buffer flushes
This commit is contained in:
parent
bffad06a26
commit
5f268e4847
1 changed files with 5 additions and 3 deletions
|
|
@ -78,14 +78,16 @@ func (socket *Socket) Write(line string) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = socket.writer.Flush(); socket.isError(err, W) {
|
go socket.flush()
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.debug.Printf("%s ← %s", socket, line)
|
Log.debug.Printf("%s ← %s", socket, line)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (socket *Socket) flush() {
|
||||||
|
socket.isError(socket.writer.Flush(), W)
|
||||||
|
}
|
||||||
|
|
||||||
func (socket *Socket) isError(err error, dir rune) bool {
|
func (socket *Socket) isError(err error, dir rune) bool {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err != io.EOF {
|
if err != io.EOF {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue