mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
bugfix : See #1535
This commit is contained in:
@@ -646,7 +646,6 @@ open_socket(struct socket_server *ss, struct request_open * request, struct sock
|
||||
|
||||
ns = new_fd(ss, id, sock, PROTOCOL_TCP, request->opaque, true);
|
||||
if (ns == NULL) {
|
||||
close(sock);
|
||||
result->data = "reach skynet socket number limit";
|
||||
goto _failed;
|
||||
}
|
||||
@@ -661,19 +660,21 @@ open_socket(struct socket_server *ss, struct request_open * request, struct sock
|
||||
freeaddrinfo( ai_list );
|
||||
return SOCKET_OPEN;
|
||||
} else {
|
||||
ATOM_STORE(&ns->type , SOCKET_TYPE_CONNECTING);
|
||||
if (enable_write(ss, ns, true)) {
|
||||
result->data = "enable write failed";
|
||||
goto _failed;
|
||||
}
|
||||
ATOM_STORE(&ns->type , SOCKET_TYPE_CONNECTING);
|
||||
}
|
||||
|
||||
freeaddrinfo( ai_list );
|
||||
return -1;
|
||||
_failed:
|
||||
if (sock >= 0)
|
||||
close(sock);
|
||||
freeaddrinfo( ai_list );
|
||||
_failed_getaddrinfo:
|
||||
ss->slot[HASH_ID(id)].type = SOCKET_TYPE_INVALID;
|
||||
ATOM_STORE(&ss->slot[HASH_ID(id)].type, SOCKET_TYPE_INVALID);
|
||||
return SOCKET_ERR;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user