Merge branch '18-bug-tail-close'
This commit is contained in:
commit
a990564f0b
2 changed files with 10 additions and 1 deletions
|
@ -149,7 +149,7 @@ func main() {
|
||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
log.Println("Successfully close")
|
log.Println("Successfully close")
|
||||||
case <-time.After(1 * time.Second):
|
case <-time.After(5 * time.Second):
|
||||||
log.Println("Forced close")
|
log.Println("Forced close")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
|
@ -153,6 +153,15 @@ func getWSHandler(hub circolog.Hub) http.HandlerFunc {
|
||||||
hub.Unregister <- c
|
hub.Unregister <- c
|
||||||
conn.Close()
|
conn.Close()
|
||||||
}()
|
}()
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
_, _, err := conn.ReadMessage()
|
||||||
|
if err != nil {
|
||||||
|
conn.Close()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case message, ok := <-c.Messages:
|
case message, ok := <-c.Messages:
|
||||||
|
|
Loading…
Reference in a new issue