Closed pasis closed 1 year ago
CC @nosnilmot
@nosnilmot I've resolved unsigned socket issue in all places I found. And returned user setsockopt functionality back before connect() syscall. Could you please check current patch again?
libstrophe-profanity-dev-profrc.txt libstrophe-profanity-dev-debug.log For the Issue #217 :
Some infos about the test environment:
sources of libstrophe: git repo (xmpp-sock branch)
libstrophe has been built in a Fedora 38 x86_64 chroot
libstrophe has been installed on the system inside a chroot (Fedora 38 x86_64)
The Fedora RPM of libstrophe was reused (dirty RPM / dirty packaging) to manage the installation in the system
profanity was installed via RPM (profanity-0.13.1-3.fc38.x86_64)
a standard user has been created and configured inside the chroot
profanity was launched as non-root
debug log is sent in attachment as proof
WORKS FOR ME.
Please merge as soon as possible :)
Some infos about the infra:
1 jabber server used as main server. 1 server as fallback.
DNS zone is configured to always redirect clients to the main server. If it doesn't answer, clients will try to connect to the secondary server.
$ dig SRV +short _xmpp-client._tcp.casperlefantom.net.
10 0 5222 jabber2.casperlefantom.net.
5 0 5222 jabber.casperlefantom.net.
For the tests, I turned off the main server (ejabberd) during few minutes. All clients got disconnected. Then, they reconnected on the fallback server.
For the /reconnect settings used during the tests, I'm adding my profrc in attachment.
XMPP account is a test account.
This patch needs review and testing!
libstrophe uses non-blocking sockets and the connect() syscall may return before a TCP connection is established. This doesn't allow to catch all possible errors synchronously and some of the errors are handled in the event handler.
In a scenario with multiple SRV records and/or multiple IP addresses resolution, we need to repeat connection attempt on a failure.
xmpp_sock_t resolves the above problem. It keeps resolved records and addresses to repeat connect attempt asynchronously.