via

Simple pubsub server inspired by https://patchbay.pub/
git clone https://git.ce9e.org/via.git

commit
ded4e29c0330c19b830a486214f44ba4cd5a6f8b
parent
ac6969d08c49badbaf11b79ace55143021d1e252
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-03-25 06:02
fix pop channel on blocking GET

Diffstat

M via.go 10 +++++++++-

1 files changed, 9 insertions, 1 deletions


diff --git a/via.go b/via.go

@@ -127,7 +127,15 @@ func getBlocking(w http.ResponseWriter, r *http.Request) {
  127   127 		return
  128   128 	}
  129   129 	defer popChannel(key, ch)
  130    -1 	w.Write(<-ch)
   -1   130 
   -1   131 	ctx := r.Context()
   -1   132 
   -1   133 	select {
   -1   134 	case <-ctx.Done():
   -1   135 		return
   -1   136 	case s := <-ch:
   -1   137 		w.Write(s)
   -1   138 	}
  131   139 }
  132   140 
  133   141 func getSse(w http.ResponseWriter, r *http.Request) {