alexandrevicenzi / go-sse

Server-Sent Events for Go
MIT License
172 stars 40 forks source link

Fix panic on sse-server shutdown #36

Open hotafrika opened 1 year ago

hotafrika commented 1 year ago

This is the fix for the "panic on sse-server shutdown when there is at least one active connection" issue. It does the following:

  1. after calling the Shutdown() function it doesn't allow new sse-connections to be established
  2. it avoids sending to already closed removeClient channel
insano10 commented 1 year ago

I've tested this forked version in an application utilising go-sse and can confirm it fixes the panic on shutdown