Skip to content

Commit

Permalink
feat: signal_or_buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhuyan committed May 22, 2024
1 parent 6d6c322 commit 09c3d0c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions c_src/quicer_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ handle_stream_event_start_complete(QuicerStreamCTX *s_ctx,
props_name,
props_value,
3);
enif_send(NULL, &(s_ctx->owner->Pid), NULL, report);
signal_or_buffer(NULL, &(s_ctx->owner->Pid), report);
}
return QUIC_STATUS_SUCCESS;
}
Expand All @@ -1080,7 +1080,7 @@ handle_stream_event_peer_send_shutdown(
enif_make_copy(env, s_ctx->eHandle),
ATOM_UNDEFINED);

enif_send(NULL, &(s_ctx->owner->Pid), NULL, report);
signal_or_buffer(NULL, &(s_ctx->owner->Pid), report);
return QUIC_STATUS_SUCCESS;
}

Expand All @@ -1101,7 +1101,7 @@ handle_stream_event_peer_send_aborted(QuicerStreamCTX *s_ctx,
enif_make_copy(env, s_ctx->eHandle),
enif_make_uint64(env, Event->PEER_SEND_ABORTED.ErrorCode));

enif_send(NULL, &(s_ctx->owner->Pid), NULL, report);
signal_or_buffer(NULL, &(s_ctx->owner->Pid), report);
return QUIC_STATUS_SUCCESS;
}

Expand All @@ -1121,7 +1121,7 @@ handle_stream_event_peer_receive_aborted(QuicerStreamCTX *s_ctx,
ATOM_PEER_RECEIVE_ABORTED,
enif_make_copy(env, s_ctx->eHandle),
enif_make_uint64(env, Event->PEER_RECEIVE_ABORTED.ErrorCode));
enif_send(NULL, &(s_ctx->owner->Pid), NULL, report);
signal_or_buffer(NULL, &(s_ctx->owner->Pid), report);
return QUIC_STATUS_SUCCESS;
}

Expand Down Expand Up @@ -1154,7 +1154,7 @@ handle_stream_event_shutdown_complete(QuicerStreamCTX *s_ctx,
props_name,
props_value,
6);
enif_send(NULL, &(s_ctx->owner->Pid), NULL, report);
signal_or_buffer(NULL, &(s_ctx->owner->Pid), report);
return QUIC_STATUS_SUCCESS;
}

Expand All @@ -1171,7 +1171,7 @@ handle_stream_event_peer_accepted(QuicerStreamCTX *s_ctx,
ATOM_PEER_ACCEPTED,
enif_make_copy(env, s_ctx->eHandle),
ATOM_UNDEFINED);
enif_send(NULL, &(s_ctx->owner->Pid), NULL, report);
signal_or_buffer(NULL, &(s_ctx->owner->Pid), report);
return QUIC_STATUS_SUCCESS;
}

Expand Down Expand Up @@ -1282,7 +1282,7 @@ signal_or_buffer(QuicerStreamCTX *s_ctx,
ErlNifPid *owner_pid,
ERL_NIF_TERM msg)
{
if (s_ctx->sig_queue != NULL)
if (s_ctx && s_ctx->sig_queue != NULL)
{ // Ongoing handoff... buffering
CXPLAT_FRE_ASSERT(ACCEPTOR_RECV_MODE_PASSIVE == s_ctx->owner->active);
ErlNifEnv *q_env = s_ctx->sig_queue->env;
Expand Down

0 comments on commit 09c3d0c

Please sign in to comment.