mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
@@ -433,6 +433,7 @@ pack_dict(lua_State *L, struct bson *b, bool isarray) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
luaL_error(L, "Invalid key type : %s", lua_typename(L, kt));
|
luaL_error(L, "Invalid key type : %s", lua_typename(L, kt));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
append_one(b, L, key, sz);
|
append_one(b, L, key, sz);
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ open_socket(struct socket_server *ss, struct request_open * request, struct sock
|
|||||||
goto _failed;
|
goto _failed;
|
||||||
}
|
}
|
||||||
int sock= -1;
|
int sock= -1;
|
||||||
for ( ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next ) {
|
for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next ) {
|
||||||
sock = socket( ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol );
|
sock = socket( ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol );
|
||||||
if ( sock < 0 ) {
|
if ( sock < 0 ) {
|
||||||
continue;
|
continue;
|
||||||
@@ -276,8 +276,8 @@ open_socket(struct socket_server *ss, struct request_open * request, struct sock
|
|||||||
if (!blocking) {
|
if (!blocking) {
|
||||||
sp_nonblocking(sock);
|
sp_nonblocking(sock);
|
||||||
}
|
}
|
||||||
status = connect( sock, ai_ptr->ai_addr, ai_ptr->ai_addrlen );
|
status = connect( sock, ai_ptr->ai_addr, ai_ptr->ai_addrlen);
|
||||||
if ( status != 0 && errno != EINPROGRESS) {
|
if ( status != 0 && errno != EINPROGRESS) {
|
||||||
close(sock);
|
close(sock);
|
||||||
sock = -1;
|
sock = -1;
|
||||||
continue;
|
continue;
|
||||||
@@ -328,7 +328,7 @@ send_buffer(struct socket_server *ss, struct socket *s, struct socket_message *r
|
|||||||
case EINTR:
|
case EINTR:
|
||||||
continue;
|
continue;
|
||||||
case EAGAIN:
|
case EAGAIN:
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
force_close(ss,s, result);
|
force_close(ss,s, result);
|
||||||
return SOCKET_CLOSE;
|
return SOCKET_CLOSE;
|
||||||
@@ -347,6 +347,11 @@ send_buffer(struct socket_server *ss, struct socket *s, struct socket_message *r
|
|||||||
s->tail = NULL;
|
s->tail = NULL;
|
||||||
sp_write(ss->event_fd, s->fd, s, false);
|
sp_write(ss->event_fd, s->fd, s, false);
|
||||||
|
|
||||||
|
if (s->type == SOCKET_TYPE_HALFCLOSE) {
|
||||||
|
force_close(ss, s, result);
|
||||||
|
return SOCKET_CLOSE;
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -575,6 +580,7 @@ forward_message(struct socket_server *ss, struct socket *s, struct socket_messag
|
|||||||
|
|
||||||
if (s->type == SOCKET_TYPE_HALFCLOSE) {
|
if (s->type == SOCKET_TYPE_HALFCLOSE) {
|
||||||
// discard recv data
|
// discard recv data
|
||||||
|
FREE(buffer);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user