Skip to content

Stop sync poller on stopped Engine.IO sockets#509

Draft
jimmystridh wants to merge 1 commit into
1c3t3a:mainfrom
jimmystridh:fix-stopped-engineio-poll-loop
Draft

Stop sync poller on stopped Engine.IO sockets#509
jimmystridh wants to merge 1 commit into
1c3t3a:mainfrom
jimmystridh:fix-stopped-engineio-poll-loop

Conversation

@jimmystridh

Copy link
Copy Markdown

Summary

This changes the sync client callback poller so a stopped Engine.IO socket is handled explicitly instead of being ignored by the polling loop.

When RawClient::poll() returns Ok(None), Iter::next() produces Error::StoppedEngineIoSocket. Before this change, poll_callback() did not treat that error as a stop or reconnect condition, so the callback polling thread could immediately poll again forever.

Behavior

  • Reconnects on StoppedEngineIoSocket when reconnect is enabled.
  • Stops the callback poller on StoppedEngineIoSocket when reconnect is disabled.
  • Emits the close callback once when polling stops because the underlying Engine.IO socket has closed.
  • Keeps Socket.IO Disconnect packet behavior controlled by reconnect_on_disconnect.

Issue

Proposed fix for #508.

Validation

  • cargo fmt --check
  • cargo test -p rust_socketio stopped_engineio_socket -- --nocapture
  • cargo test -p rust_socketio socketio_disconnect_obeys_reconnect_on_disconnect -- --nocapture
  • cargo test -p rust_socketio ordinary_packets_keep_polling -- --nocapture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant