1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-17 02:16:54 +00:00

Attempt to fix locking issue

This commit is contained in:
Kane York 2015-11-03 16:44:42 -08:00
parent db486e4eba
commit 7b095542fc
3 changed files with 11 additions and 2 deletions

View file

@ -152,6 +152,7 @@ func HandleSocketConnection(conn *websocket.Conn) {
var client ClientInfo
client.MessageChannel = _serverMessageChan
client.RemoteAddr = conn.RemoteAddr()
client.MsgChannelIsDone = stoppedChan
// Launch receiver goroutine
go func(errorChan chan<- error, clientChan chan<- ClientMessage, stoppedChan <-chan struct{}) {
@ -186,7 +187,10 @@ func HandleSocketConnection(conn *websocket.Conn) {
if err != io.EOF && !isClose {
log.Println("Error while reading from client:", err)
}
errorChan <- err
select {
case errorChan <- err:
case <-stoppedChan:
}
close(errorChan)
close(clientChan)
// exit