- if(sa->sa.sa_family == AF_INET && get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice) && choice) {
- option = IP_PMTUDISC_DO;
- if(setsockopt(nfd, SOL_IP, IP_MTU_DISCOVER, &option, sizeof(option))) {
- closesocket(nfd);
- logger(LOG_ERR, _("Can't set PMTU discovery mode: %s"), strerror(errno));
- return -1;
- }
+static void handle_meta_io(event_loop_t *loop, void *data, int flags) {
+ meshlink_handle_t *mesh = loop->data;
+ connection_t *c = data;
+
+ if(c->status.connecting) {
+ c->status.connecting = false;
+
+ int result;
+ socklen_t len = sizeof(result);
+ getsockopt(c->socket, SOL_SOCKET, SO_ERROR, (void *)&result, &len);
+
+ if(!result) {
+ finish_connecting(mesh, c);
+ } else {
+ logger(mesh, MESHLINK_DEBUG, "Error while connecting to %s: %s", c->name, sockstrerror(result));
+ terminate_connection(mesh, c, false);
+ return;