Skip to content

Commit

Permalink
add:websocket添加没有tls时的返回
Browse files Browse the repository at this point in the history
  • Loading branch information
Dozingfiretruck committed Mar 23, 2023
1 parent 1fec119 commit 00178ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion components/network/websocket/luat_lib_websocket.c
Expand Up @@ -206,7 +206,11 @@ static int l_websocket_create(lua_State *L)
opts.url = luaL_checklstring(L, 2, &ip_len);

ret = luat_websocket_set_connopts(websocket_ctrl, luaL_checklstring(L, 2, &ip_len));

if (ret){
luat_websocket_release_socket(websocket_ctrl);
return 0;
}

// TODO 判断ret, 如果初始化失败, 应该终止

luaL_setmetatable(L, LUAT_WEBSOCKET_CTRL_TYPE);
Expand Down
4 changes: 3 additions & 1 deletion components/network/websocket/luat_websocket.c
Expand Up @@ -240,7 +240,9 @@ int luat_websocket_set_connopts(luat_websocket_ctrl_t *websocket_ctrl, const cha

if (is_tls)
{
network_init_tls(websocket_ctrl->netc, 0);
if (network_init_tls(websocket_ctrl->netc, 0)){
return -1;
}
}
else
{
Expand Down

0 comments on commit 00178ae

Please sign in to comment.