mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
@@ -599,7 +599,9 @@ static int
|
|||||||
ludp_address(lua_State *L) {
|
ludp_address(lua_State *L) {
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
const uint8_t * addr = (const uint8_t *)luaL_checklstring(L, 1, &sz);
|
const uint8_t * addr = (const uint8_t *)luaL_checklstring(L, 1, &sz);
|
||||||
int port = addr[1] * 256 + addr[2];
|
uint16_t port = 0;
|
||||||
|
memcpy(&port, addr+1, sizeof(uint16_t));
|
||||||
|
port = ntohs(port);
|
||||||
const void * src = addr+3;
|
const void * src = addr+3;
|
||||||
char tmp[256];
|
char tmp[256];
|
||||||
int family;
|
int family;
|
||||||
|
|||||||
@@ -720,6 +720,7 @@ send_socket(struct socket_server *ss, struct request_send * request, struct sock
|
|||||||
append_sendbuffer_udp(ss,s,priority,request,udp_address);
|
append_sendbuffer_udp(ss,s,priority,request,udp_address);
|
||||||
} else {
|
} else {
|
||||||
so.free_func(request->buffer);
|
so.free_func(request->buffer);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sp_write(ss->event_fd, s->fd, s, true);
|
sp_write(ss->event_fd, s->fd, s, true);
|
||||||
@@ -887,6 +888,7 @@ add_udp_socket(struct socket_server *ss, struct request_udp *udp) {
|
|||||||
if (ns == NULL) {
|
if (ns == NULL) {
|
||||||
close(udp->fd);
|
close(udp->fd);
|
||||||
ss->slot[HASH_ID(id)].type = SOCKET_TYPE_INVALID;
|
ss->slot[HASH_ID(id)].type = SOCKET_TYPE_INVALID;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
ns->type = SOCKET_TYPE_CONNECTED;
|
ns->type = SOCKET_TYPE_CONNECTED;
|
||||||
memset(ns->p.udp_address, 0, sizeof(ns->p.udp_address));
|
memset(ns->p.udp_address, 0, sizeof(ns->p.udp_address));
|
||||||
|
|||||||
Reference in New Issue
Block a user