Commit 6d37281c authored by Sebastien Decugis's avatar Sebastien Decugis
Browse files

Cleanup termination

parent 1d4f46c1
......@@ -509,13 +509,14 @@ void fd_cnx_markerror(struct cnxctx * conn)
TRACE_ENTRY("%p", conn);
CHECK_PARAMS_DO( conn, goto fatal );
TRACE_DEBUG(FULL, "Connection (%d) CC_STATUS_ERROR set", conn->cc_socket);
TRACE_DEBUG(FULL, "CC_STATUS_ERROR set for socket %d (%s)", conn->cc_socket, conn->cc_id);
/* Mark the error */
conn->cc_status |= CC_STATUS_ERROR;
/* Report the error if not reported yet, and not closing */
if ((!(conn->cc_status & CC_STATUS_CLOSING )) && (!(conn->cc_status & CC_STATUS_SIGNALED ))) {
TRACE_DEBUG(FULL, "Sending FDEVP_CNX_ERROR event");
CHECK_FCT_DO( fd_event_send( Target_Queue(conn), FDEVP_CNX_ERROR, 0, NULL), goto fatal);
conn->cc_status |= CC_STATUS_SIGNALED;
}
......
......@@ -114,6 +114,11 @@ static void * demuxer(void * arg)
} while (conn->cc_loop);
out:
/* Signal termination of the connection to all decipher threads */
for (strid = 0; strid < conn->cc_sctp_para.pairs; strid++) {
if (conn->cc_sctps_data.array[strid].raw_recv)
CHECK_FCT_DO(fd_event_send(conn->cc_sctps_data.array[strid].raw_recv, FDEVP_CNX_ERROR, 0, NULL), goto fatal );
}
TRACE_DEBUG(FULL, "Thread terminated");
return NULL;
......@@ -180,7 +185,8 @@ static ssize_t sctps_pull(gnutls_transport_ptr_t tr, void * buf, size_t len)
if (!ctx->partial.buf) {
int ev;
CHECK_FCT_DO( errno = fd_event_get(ctx->raw_recv, &ev, &ctx->partial.bufsz, (void *)&ctx->partial.buf), return -1 );
ASSERT( ev == FDEVP_CNX_MSG_RECV );
if (ev == FDEVP_CNX_ERROR)
return 0; /* connection closed */
}
pulled = ctx->partial.bufsz - ctx->partial.offset;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment