livepeer / go-livepeer-basicnet

Basic p2p video streaming for Livepeer
MIT License
18 stars 8 forks source link

Return an err if sending to a nil BasicOutStream. #41

Closed j0sh closed 6 years ago

j0sh commented 6 years ago

Prevents a segfault further down in the same method.

The segfault was reproducible under the following scenario on devenv:

  1. Begin broadcasting (also act as bootnode for transcoder)
  2. Transcoding begins.
  3. Kill transcoder (ctrl-C in this case; not sure if this was a 'clean' kill as far as TCP teardowns go).
  4. Broadcaster / bootnode attempts to reconnect to transcoder
  5. Reconnect fails
  6. Broadcaster tries to send a data message anyway
  7. 💥

By returning ErrOutStream here, the listener also gets removed and the broadcaster no longer attempts to send data.

ericxtang commented 6 years ago

Good catch. 🚢