summaryrefslogtreecommitdiff
path: root/src/rexmpp_tcp.c
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2023-12-07 13:54:45 +0300
committerdefanor <defanor@uberspace.net>2023-12-07 14:40:51 +0300
commitb349a15d9221e1e9d6736eccb7357294399eb830 (patch)
treef6168ea6ddf5c6745758ea65ca5d6bf59dafcb34 /src/rexmpp_tcp.c
parentecbef993632c9b3bdf442b381e02e1ad24bc1c87 (diff)
Provide a callback after socket creation, use _Bool
The callback is provided to set socket options, instead of individual options such as path_mtu_discovery (which is now removed). Noticed that the Rust rexmpp structure's C representation does not match that of C, since Rust's "bool" maps to C99's "_Bool", while I thought that it maps to "int" (c_int). Adjusted C structures to use "bool" from stdbool.h as well, since C99 (GNU99) is used already.
Diffstat (limited to 'src/rexmpp_tcp.c')
-rw-r--r--src/rexmpp_tcp.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/rexmpp_tcp.c b/src/rexmpp_tcp.c
index a9c5547..c6a53a5 100644
--- a/src/rexmpp_tcp.c
+++ b/src/rexmpp_tcp.c
@@ -106,10 +106,9 @@ int rexmpp_tcp_socket(rexmpp_t *s, int domain) {
int flags = fcntl(sock, F_GETFL, 0);
fcntl(sock, F_SETFL, flags | O_NONBLOCK);
- /* Set path MTU discovery, if provided */
- if (s->path_mtu_discovery != -1) {
- setsockopt(sock, SOL_IP, IP_MTU_DISCOVER, &(s->path_mtu_discovery),
- sizeof(s->path_mtu_discovery));
+ /* Call the socket creation callback, if provided */
+ if (s->socket_cb != NULL) {
+ s->socket_cb(s, sock);
}
return sock;