aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-usockets/src/socket.c
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-09-14 21:26:37 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-14 21:26:37 -0700
commitced69d38180e963da1206f9932db76666cec9f72 (patch)
treea4c4462ff8747adc7d092891b1c299dfbb0ecc4a /packages/bun-usockets/src/socket.c
parentb262b0153a2d9667fcb47a970e8027d3b54f8a0a (diff)
downloadbun-ced69d38180e963da1206f9932db76666cec9f72.tar.gz
bun-ced69d38180e963da1206f9932db76666cec9f72.tar.zst
bun-ced69d38180e963da1206f9932db76666cec9f72.zip
async-ify all node:fs functions (#5360)
* async all node:fs functions * draw the rest of the owl * LLVM & Clang 16 --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'packages/bun-usockets/src/socket.c')
-rw-r--r--packages/bun-usockets/src/socket.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/packages/bun-usockets/src/socket.c b/packages/bun-usockets/src/socket.c
index 5f5a91acb..ce5203ccb 100644
--- a/packages/bun-usockets/src/socket.c
+++ b/packages/bun-usockets/src/socket.c
@@ -140,59 +140,6 @@ struct us_socket_t *us_socket_close(int ssl, struct us_socket_t *s, int code, vo
return s;
}
-// This function is the same as us_socket_close but:
-// - does not emit on_close event
-// - does not close
-struct us_socket_t *us_socket_detach(int ssl, struct us_socket_t *s) {
- if (!us_socket_is_closed(0, s)) {
- if (s->low_prio_state == 1) {
- /* Unlink this socket from the low-priority queue */
- if (!s->prev) s->context->loop->data.low_prio_head = s->next;
- else s->prev->next = s->next;
-
- if (s->next) s->next->prev = s->prev;
-
- s->prev = 0;
- s->next = 0;
- s->low_prio_state = 0;
- } else {
- us_internal_socket_context_unlink(s->context, s);
- }
- us_poll_stop((struct us_poll_t *) s, s->context->loop);
-
- /* Link this socket to the close-list and let it be deleted after this iteration */
- s->next = s->context->loop->data.closed_head;
- s->context->loop->data.closed_head = s;
-
- /* Any socket with prev = context is marked as closed */
- s->prev = (struct us_socket_t *) s->context;
-
- return s;
- }
- return s;
-}
-
-// This function is used for moving a socket between two different event loops
-struct us_socket_t *us_socket_attach(int ssl, LIBUS_SOCKET_DESCRIPTOR client_fd, struct us_socket_context_t *ctx, int flags, int socket_ext_size) {
- struct us_poll_t *accepted_p = us_create_poll(ctx->loop, 0, sizeof(struct us_socket_t) - sizeof(struct us_poll_t) + socket_ext_size);
- us_poll_init(accepted_p, client_fd, POLL_TYPE_SOCKET);
- us_poll_start(accepted_p, ctx->loop, flags);
-
- struct us_socket_t *s = (struct us_socket_t *) accepted_p;
-
- s->context = ctx;
- s->timeout = 0;
- s->low_prio_state = 0;
-
- /* We always use nodelay */
- bsd_socket_nodelay(client_fd, 1);
- us_internal_socket_context_link(ctx, s);
-
- if (ctx->on_open) ctx->on_open(s, 0, 0, 0);
-
- return s;
-}
-
struct us_socket_t *us_socket_pair(struct us_socket_context_t *ctx, int socket_ext_size, LIBUS_SOCKET_DESCRIPTOR* fds) {
#ifdef LIBUS_USE_LIBUV
return 0;