这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
build-alpine:
name: Alpine Linux
runs-on: ubuntu-latest
container: alpine:3.19
container: alpine:3.21
strategy:
fail-fast: false
matrix:
Expand All @@ -130,15 +130,15 @@ jobs:
BUILDTYPE: ${{ matrix.buildType }}
steps:
- name: Prepare
run: apk add git build-base cmake curl-dev autoconf automake libtool texinfo linux-headers --update-cache
run: apk add git build-base cmake curl-dev autoconf automake libtool texinfo linux-headers libffi-dev --update-cache
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Build it
run: make VERBOSE=1
run: make VERBOSE=1 USE_EXTERNAL_FFI=ON
- name: Test it
run: make test
build-windows:
Expand Down
21 changes: 12 additions & 9 deletions src/curl-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,15 @@ static void uv__poll_cb(uv_poll_t *handle, int status, int events) {
CHECK_NOT_NULL(qrt);

int flags = 0;
if (events & UV_READABLE) {
flags |= CURL_CSELECT_IN;
}
if (events & UV_WRITABLE) {
flags |= CURL_CSELECT_OUT;
if (status != 0) {
flags |= CURL_CSELECT_ERR;
} else {
if (events & UV_READABLE) {
flags |= CURL_CSELECT_IN;
}
if (events & UV_WRITABLE) {
flags |= CURL_CSELECT_OUT;
}
}

int running_handles;
Expand Down Expand Up @@ -197,12 +201,11 @@ static int curl__handle_socket(CURL *easy, curl_socket_t s, int action, void *us
poll_ctx->qrt = qrt;
poll_ctx->sockfd = s;
poll_ctx->poll.data = poll_ctx;
curl_multi_assign(qrt->curl_ctx.curlm_h, s, (void *) poll_ctx);
} else {
poll_ctx = socketp;
}

curl_multi_assign(qrt->curl_ctx.curlm_h, s, (void *) poll_ctx);

int events = 0;
if (action != CURL_POLL_IN) {
events |= UV_WRITABLE;
Expand All @@ -222,8 +225,8 @@ static int curl__handle_socket(CURL *easy, curl_socket_t s, int action, void *us
uv_close((uv_handle_t *) &poll_ctx->poll, uv__poll_close_cb);
}
break;
default:
abort();
case CURL_POLL_NONE:
break;
}

return 0;
Expand Down
20 changes: 10 additions & 10 deletions src/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,16 @@ void TJS_FreeRuntime(TJSRuntime *qrt) {
JS_FreeContext(qrt->ctx);
JS_FreeRuntime(qrt->rt);

/* Destroy CURLM handle. */
if (qrt->curl_ctx.curlm_h) {
curl_multi_cleanup(qrt->curl_ctx.curlm_h);
qrt->curl_ctx.curlm_h = NULL;
}

/* Destroy WASM runtime. */
m3_FreeEnvironment(qrt->wasm_ctx.env);
qrt->wasm_ctx.env = NULL;

/* Cleanup loop. All handles should be closed. */
int closed = 0;
for (int i = 0; i < 5; i++) {
Expand All @@ -368,16 +378,6 @@ void TJS_FreeRuntime(TJSRuntime *qrt) {
(void) closed;
#endif

/* Destroy CURLM handle. */
if (qrt->curl_ctx.curlm_h) {
curl_multi_cleanup(qrt->curl_ctx.curlm_h);
qrt->curl_ctx.curlm_h = NULL;
}

/* Destroy WASM runtime. */
m3_FreeEnvironment(qrt->wasm_ctx.env);
qrt->wasm_ctx.env = NULL;

tjs__free(qrt);
}

Expand Down
Loading