Propagate +6 flag across network. Show correct error when outbound connections fail.
[ircu2.10.12-pk.git] / ircd / s_bsd.c
index 67edbbb352299e882548c5cc1a8a5d4985b93f9f..63a0228517e68d5f3c18a87fe4f2c9062b8d9312 100644 (file)
@@ -900,6 +900,11 @@ static void client_sock_callback(struct Event* ev)
     cli_error(cptr) = ev_data(ev);
     if (s_state(&(con_socket(con))) == SS_CONNECTING) {
       completed_connection(cptr);
+      /* for some reason, the os_get_sockerr() in completed_connect()
+       * can return 0 even when ev_data(ev) indicates a real error, so
+       * re-assign the client error here.
+       */
+      cli_error(cptr) = ev_data(ev);
       break;
     }
     /*FALLTHROUGH*/