instrumentisto / medea

[Closed] Medea media server
Mozilla Public License 2.0
23 stars 3 forks source link

Fix WsSession close without notifying Room and Commands not being transmitted #76

Closed alexlapa closed 4 years ago

alexlapa commented 4 years ago

Synopsis

According to medea-demo logs after some usage:

  1. try_send fails here with SendError::Full (send failed because receiver is full).
  2. WsSession can be stopped without notifying Room due to ws::Message stream being finished without emitting ws::Message::Close frame or ws::ProtocolError.

Solution

  1. Replace try_send with send.
  2. Emit RpcConnectionClosed message in WsSession actor stopped() callback.

Additionally:

  1. Cover WsSession with tests.
  2. Rework Medea HTTP server tests.
  3. Add RpcServer trait and impl it for'Addr<Room>, to make WsSession testable.
  4. Split HTTP server configuration to Server::register_data and Server::configure to reuse configuration in tests.

Checklist

alexlapa commented 4 years ago

FCM:

Fix WsSession closing without notifying Room and Commands (#76)

- use Addr::send() instead of Addr::try_send() in WsSession when sending messages to Room
- ensure RpcConnectionClosed is sent when WsSession is stopped

Additionally:
- improve WsSession tests
- improve Medea's HTTP server tests