Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #447 from laijs/prune-ctlchan
Browse files Browse the repository at this point in the history
prune h.ctlChan in h.Close()
  • Loading branch information
laijs authored Mar 15, 2017
2 parents 07f6afd + 0cd400c commit 23cbab6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions hyperstart/libhyperstart/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ func (h *jsonBasedHyperstart) Close() {
close(h.ctlChan)
close(h.streamChan)
close(h.processAsyncEvents)
for cmd := range h.ctlChan {
if cmd.Code != hyperstartapi.INIT_ACK && cmd.Code != hyperstartapi.INIT_ERROR {
cmd.result <- fmt.Errorf("hyperstart closed")
}
}
h.closed = true
}
}
Expand Down Expand Up @@ -292,11 +297,7 @@ func handleMsgToHyperstart(h *jsonBasedHyperstart, conn io.WriteCloser) {
for _, cmd := range cmds {
cmd.result <- fmt.Errorf("hyperstart closed")
}
for cmd := range h.ctlChan {
if cmd.Code != hyperstartapi.INIT_ACK && cmd.Code != hyperstartapi.INIT_ERROR {
cmd.result <- fmt.Errorf("hyperstart closed")
}
}
h.Close()
}

func handleMsgFromHyperstart(h *jsonBasedHyperstart, conn io.Reader) {
Expand Down

0 comments on commit 23cbab6

Please sign in to comment.