forked from boyska/circolog
FIX #18 server close connections
I am not sure this really fixes the problem (but it seems to)
This commit is contained in:
parent
d3799d19f9
commit
5717c7ca29
2 changed files with 9 additions and 1 deletions
|
@ -149,7 +149,7 @@ func main() {
|
|||
select {
|
||||
case <-done:
|
||||
log.Println("Successfully close")
|
||||
case <-time.After(1 * time.Second):
|
||||
case <-time.After(5 * time.Second):
|
||||
log.Println("Forced close")
|
||||
}
|
||||
return
|
||||
|
|
|
@ -153,6 +153,14 @@ func getWSHandler(hub circolog.Hub) http.HandlerFunc {
|
|||
hub.Unregister <- c
|
||||
conn.Close()
|
||||
}()
|
||||
go func() {
|
||||
for {
|
||||
_, _, err := conn.ReadMessage()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
for {
|
||||
select {
|
||||
case message, ok := <-c.Messages:
|
||||
|
|
Loading…
Reference in a new issue