mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
fix: httpc支持ipv6 (#2125)
* fix: httpc支持ipv6 * httpc ip:port解析放在c层 * lua-socket.c listen增加ip:port字符串解析, 相关cluster代码修改 #2124 * socketchannel changehost port可置空 * socketchannel changehost恢复port判空 * httpc解析域名加端口号逻辑优化 * 注释中字符串模式内容格式优化 --------- Co-authored-by: zhuyin.zhu <zhuyin.zhu@bytedance.com>
This commit is contained in:
@@ -484,8 +484,14 @@ lshutdown(lua_State *L) {
|
||||
|
||||
static int
|
||||
llisten(lua_State *L) {
|
||||
const char * host = luaL_checkstring(L,1);
|
||||
int port = luaL_checkinteger(L,2);
|
||||
size_t sz = 0;
|
||||
const char * addr = luaL_checklstring(L, 1, &sz);
|
||||
char tmp[sz];
|
||||
int port = 0;
|
||||
const char * host = address_port(L, tmp, addr, 2, &port);
|
||||
if (port == 0) {
|
||||
return luaL_error(L, "Invalid port");
|
||||
}
|
||||
int backlog = luaL_optinteger(L,3,BACKLOG);
|
||||
struct skynet_context * ctx = lua_touserdata(L, lua_upvalueindex(1));
|
||||
int id = skynet_socket_listen(ctx, host,port,backlog);
|
||||
|
||||
Reference in New Issue
Block a user