Skip to content

Commit

Permalink
no inits allowed post teardown
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh committed Dec 9, 2024
1 parent 5eab80e commit b1fb68b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/udx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1992,6 +1992,8 @@ udx_teardown (udx_t *udx) {

int
udx_socket_init (udx_t *udx, udx_socket_t *socket, udx_socket_close_cb cb) {
if (udx->teardown) return UV_EINVAL;

udx->refs++;

udx__link_add(udx->sockets, socket);
Expand Down Expand Up @@ -2252,6 +2254,8 @@ udx_socket_close (udx_socket_t *socket) {

int
udx_stream_init (udx_t *udx, udx_stream_t *stream, uint32_t local_id, udx_stream_close_cb close_cb, udx_stream_finalize_cb finalize_cb) {
if (udx->teardown) return UV_EINVAL;

udx->refs++;

if (!(udx->allocated)) {
Expand Down Expand Up @@ -2754,12 +2758,14 @@ on_uv_getaddrinfo (uv_getaddrinfo_t *req, int status, struct addrinfo *res) {

int
udx_lookup (udx_t *udx, udx_lookup_t *req, const char *host, unsigned int flags, udx_lookup_cb cb) {
if (udx->teardown) return UV_EINVAL;

udx->refs++;

req->udx = udx;
req->on_lookup = cb;
req->req.data = req;

udx->refs++;

memset(&req->hints, 0, sizeof(struct addrinfo));

int family = AF_UNSPEC;
Expand Down Expand Up @@ -2847,6 +2853,8 @@ on_interface_event_close (uv_handle_t *handle) {

int
udx_interface_event_init (udx_t *udx, udx_interface_event_t *handle, udx_interface_event_close_cb cb) {
if (udx->teardown) return UV_EINVAL;

handle->udx = udx;
handle->loop = udx->loop;
handle->sorted = false;
Expand Down

0 comments on commit b1fb68b

Please sign in to comment.