-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sent data handler, or socket/tls write error handling #82
Comments
Libstrophe is low-level library and this applies some restrictions. We can't simply resend items, because they may be valid only within current session. Resending is responsibility of user (user of the library, program in most cases). You're right, would be nice to have some "reliable" interface or access to unsent items. You can try to play around connection_handler. User notified with event Also, as you said, send_queue should be cleared on a connection error. Since connection_handler may want to access the queue and call What about handler for successfully sent items: user can mix |
Good point, looks like solution. Will try.
Purging queue in |
Fix for the send_queue is already in master and reconnect works. Access to unsent data is not in priority for the next release (0.9), but may be added in some future release. |
Seems that there is one thing missed in xmpp_run_once.
xmpp_send just put data into send queue and immidiately returns, so it can't return the result of actual socket/tls write.
If connection error occur while xmpp_run_once sends queued data, there are no way to find out what data from the queue was sent and what was not. Also, there are no way for queue with unsent data to survive reconnect, since connection queue uses the same queue for authorisation etc, so, you have to release connection and connect again loosing send queue without possibility to save it somehow.
There must be some notification about error with possibility to save unsent data, or, in better case allow a callback (handler) for "queued data item sent successfully" event with a pointer to sent data, just before xmpp_free(ctx, sq->data);. In latter case application can mark data as sent/unsent and try to resend something in case of reconnect.
I can try to write some patch for this, but not shure what is the right solution.
The text was updated successfully, but these errors were encountered: