mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-23 11:12:44 +01:00
socket: Fix quitting
This commit is contained in:
parent
7aaa30d399
commit
86957d4392
@ -140,6 +140,12 @@ func (socket *Socket) RunSocketWriter() {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check number of lines to send
|
||||||
|
if len(socket.linesToSend) < 1 {
|
||||||
|
fmt.Println("No line to send found on socket writer")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// check sendq
|
// check sendq
|
||||||
var sendQBytes uint64
|
var sendQBytes uint64
|
||||||
for _, line := range socket.linesToSend {
|
for _, line := range socket.linesToSend {
|
||||||
@ -173,17 +179,16 @@ func (socket *Socket) RunSocketWriter() {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we're closed
|
|
||||||
if socket.Closed {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if errOut {
|
if errOut || socket.Closed {
|
||||||
// error out, bad stuff happened
|
// error out or we've been closed
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// empty the lineToSendExists channel
|
||||||
|
for 0 < len(socket.lineToSendExists) {
|
||||||
|
<-socket.lineToSendExists
|
||||||
|
}
|
||||||
//TODO(dan): empty socket.lineToSendExists queue
|
//TODO(dan): empty socket.lineToSendExists queue
|
||||||
socket.conn.Close()
|
socket.conn.Close()
|
||||||
if !socket.Closed {
|
if !socket.Closed {
|
||||||
|
Loading…
Reference in New Issue
Block a user