Comments (3)
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).
Second, any change must not break existent programs.
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 XMPP_CONN_DISCONNECT
from conn_disconnect()
on errors. And at this point conn contains unsent items. Just a quick thought: you can make interface xmpp_conn_unsent_nr()/next() and user can go through the messages and save ones need to be resent. But user doesn't work with raw strings, so I think next() should return xmpp_stanza_t. Libstrophe stores complete stanzas in raw strings in the send_queue what makes this approach possible.
Also, as you said, send_queue should be cleared on a connection error. Since connection_handler may want to access the queue and call xmpp_connect_client()
we can't clear queue neither before nor after handler's call in conn_disconnect()
. But we can clear it at the top of connect-like functions with some static function conn_send_queue_purge()
.
What about handler for successfully sent items: user can mix xmpp_send()
and xmpp_send_raw()
.
from libstrophe.
User notified with event
XMPP_CONN_DISCONNECT
fromconn_disconnect()
on errors. And at this point conn contains unsent items. Just a quick thought: you can make interfacexmpp_conn_unsent_nr()
/next()
and user can go through the messages and save ones need to be resent.
Good point, looks like solution. Will try.
Also, as you said, send_queue should be cleared on a connection error. Since connection_handler may want to access the queue and call
xmpp_connect_client()
we can't clear queue neither before nor after handler's call inconn_disconnect()
. But we can clear it at the top of connect-like functions with some static functionconn_send_queue_purge()
Purging queue in xmpp_connect_client
is a good idea. This will allow to make "short cycle" reconnects possible, without releasing connection, creating new connection and setting same credentials again. Will try to make a patch.
from libstrophe.
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.
from libstrophe.
Related Issues (20)
- /usr/bin/x86_64-w64-mingw32-ld: cannot find -lresolv HOT 3
- Undefined symbol: _xmpp_vsnprintf _xmpp_snprintf when compiling for arm64 HOT 7
- Add stdcall call method macro HOT 2
- Tests fail without static libraries HOT 4
- Double free in gnutls library HOT 6
- `undefined reference` errors during example compilation: what am I missing? HOT 9
- Is it possible to build libstrophe for iOS? HOT 2
- cannot connect when vpn active HOT 2
- memory leak at xmpp_alloc HOT 2
- library API's exported but missing from header HOT 2
- SO versioning not done correctly HOT 3
- How to use in visual studio? HOT 7
- Sending a message to a user HOT 21
- Feature Request - expose _escape_xml to public (via fmt) HOT 1
- XEP 0178 PEM password prompt despite no password on the p12 encrypted certificate
- Continuous Bosh Request HOT 2
- Resending of old messages on reconnect HOT 7
- Not working with multiple FQDNs in DNS response HOT 6
- specify the network interface from which the xmpp traffic will be sent HOT 1
- Issue with Stream Management resumption HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libstrophe.