Revert "udp socket bugfix (#1640)"

This reverts commit 2a8c095e38.
This commit is contained in:
Cloud Wu
2022-09-03 22:02:45 +08:00
parent 2a8c095e38
commit 6dda5f7f98
5 changed files with 6 additions and 7 deletions

View File

@@ -648,13 +648,12 @@ ludp(lua_State *L) {
host = address_port(L, tmp, addr, 2, &port);
}
int id = skynet_socket_udp(ctx, host, &port);
int id = skynet_socket_udp(ctx, host, port);
if (id < 0) {
return luaL_error(L, "udp init failed");
}
lua_pushinteger(L, id);
lua_pushinteger(L, port);
return 2;
return 1;
}
static int

View File

@@ -175,7 +175,7 @@ skynet_socket_nodelay(struct skynet_context *ctx, int id) {
}
int
skynet_socket_udp(struct skynet_context *ctx, const char * addr, int *port) {
skynet_socket_udp(struct skynet_context *ctx, const char * addr, int port) {
uint32_t source = skynet_context_handle(ctx);
return socket_server_udp(SOCKET_SERVER, source, addr, port);
}

View File

@@ -38,7 +38,7 @@ void skynet_socket_start(struct skynet_context *ctx, int id);
void skynet_socket_pause(struct skynet_context *ctx, int id);
void skynet_socket_nodelay(struct skynet_context *ctx, int id);
int skynet_socket_udp(struct skynet_context *ctx, const char * addr, int *port);
int skynet_socket_udp(struct skynet_context *ctx, const char * addr, int port);
int skynet_socket_udp_connect(struct skynet_context *ctx, int id, const char * addr, int port);
int skynet_socket_udp_sendbuffer(struct skynet_context *ctx, const char * address, struct socket_sendbuffer *buffer);
const char * skynet_socket_udp_address(struct skynet_socket_message *, int *addrsz);

View File

@@ -2070,7 +2070,7 @@ socket_server_userobject(struct socket_server *ss, struct socket_object_interfac
// UDP
int
socket_server_udp(struct socket_server *ss, uintptr_t opaque, const char * addr, int *port) {
socket_server_udp(struct socket_server *ss, uintptr_t opaque, const char * addr, int port) {
int fd;
int family;
if (port != 0 || addr != NULL) {

View File

@@ -54,7 +54,7 @@ struct socket_udp_address;
// create an udp socket handle, attach opaque with it . udp socket don't need call socket_server_start to recv message
// if port != 0, bind the socket . if addr == NULL, bind ipv4 0.0.0.0 . If you want to use ipv6, addr can be "::" and port 0.
int socket_server_udp(struct socket_server *, uintptr_t opaque, const char * addr, int *port);
int socket_server_udp(struct socket_server *, uintptr_t opaque, const char * addr, int port);
// set default dest address, return 0 when success
int socket_server_udp_connect(struct socket_server *, int id, const char * addr, int port);
// If the socket_udp_address is NULL, use last call socket_server_udp_connect address instead