diff --git a/mongoose.c b/mongoose.c index 76107918..dd9f7c0d 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4214,7 +4214,8 @@ void mg_connect_resolved(struct mg_connection *c) { if ((rc = connect(FD(c), &usa.sa, slen)) == 0) { mg_call(c, MG_EV_CONNECT, NULL); } else if (mg_sock_would_block()) { - MG_DEBUG(("%lu %p -> %x:%hu pend", c->id, c->fd, c->rem.ip, c->rem.port)); + MG_DEBUG(("%lu %p -> %x:%hu pend", c->id, c->fd, mg_ntohl(c->rem.ip), + mg_ntohs(c->rem.port))); c->is_connecting = 1; } else { mg_error(c, "connect: %d", MG_SOCK_ERRNO); diff --git a/src/sock.c b/src/sock.c index 405ec021..5b5cacce 100644 --- a/src/sock.c +++ b/src/sock.c @@ -369,7 +369,8 @@ void mg_connect_resolved(struct mg_connection *c) { if ((rc = connect(FD(c), &usa.sa, slen)) == 0) { mg_call(c, MG_EV_CONNECT, NULL); } else if (mg_sock_would_block()) { - MG_DEBUG(("%lu %p -> %x:%hu pend", c->id, c->fd, c->rem.ip, c->rem.port)); + MG_DEBUG(("%lu %p -> %x:%hu pend", c->id, c->fd, mg_ntohl(c->rem.ip), + mg_ntohs(c->rem.port))); c->is_connecting = 1; } else { mg_error(c, "connect: %d", MG_SOCK_ERRNO); diff --git a/test/unit_test.c b/test/unit_test.c index d77dc579..9b1d213a 100644 --- a/test/unit_test.c +++ b/test/unit_test.c @@ -739,7 +739,8 @@ static void test_http_server(void) { // Test connection refused int i, errored = 0; mg_connect(&mgr, "tcp://127.0.0.1:55117", eh9, &errored); - for (i = 0; i < 10 && errored == 0; i++) mg_mgr_poll(&mgr, 1); + // Give it a couple of seconds, see #1605 + for (i = 0; i < 200 && errored == 0; i++) mg_mgr_poll(&mgr, 10); MG_INFO(("errored: %d, expected: 7", errored)); ASSERT(errored == 7); }