We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 025f5ab commit 0d53e2eCopy full SHA for 0d53e2e
1 file changed
src/extensions/std_net_socket.c
@@ -567,6 +567,18 @@ LGX_METHOD(Socket, close) {
567
LGX_METHOD_ARGS_INIT();
568
LGX_METHOD_ARGS_THIS(obj);
569
570
+ lgx_val_t *res = lgx_obj_get_s(obj->v.obj, "ctx");
571
+ if (!res || res->type != T_RESOURCE) {
572
+ lgx_vm_throw_s(vm, "invalid property `ctx`");
573
+ return 1;
574
+ }
575
+
576
+ lgx_socket_t *sock = (lgx_socket_t *)res->v.res->buf;
577
+ if (sock->fd) {
578
+ wbt_close_socket(sock->fd);
579
+ sock->fd = -1;
580
581
582
LGX_RETURN_TRUE();
583
return 0;
584
}
0 commit comments