mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-23 03:02:48 +01:00
socket: Fix quitting
This commit is contained in:
parent
7aaa30d399
commit
86957d4392
@ -140,6 +140,12 @@ func (socket *Socket) RunSocketWriter() {
|
||||
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
|
||||
var sendQBytes uint64
|
||||
for _, line := range socket.linesToSend {
|
||||
@ -173,16 +179,15 @@ func (socket *Socket) RunSocketWriter() {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// check if we're closed
|
||||
if socket.Closed {
|
||||
}
|
||||
if errOut || socket.Closed {
|
||||
// error out or we've been closed
|
||||
break
|
||||
}
|
||||
}
|
||||
if errOut {
|
||||
// error out, bad stuff happened
|
||||
break
|
||||
}
|
||||
// empty the lineToSendExists channel
|
||||
for 0 < len(socket.lineToSendExists) {
|
||||
<-socket.lineToSendExists
|
||||
}
|
||||
//TODO(dan): empty socket.lineToSendExists queue
|
||||
socket.conn.Close()
|
||||
|
Loading…
Reference in New Issue
Block a user