# HG changeset patch # User Sebastien Decugis # Date 1266905388 -32400 # Node ID 85dc47afeac7f3c80253a1332989e8a490d37c6a # Parent c8ad11effa95ef944716524c4b29191f989180f9 Cleanup termination diff -r c8ad11effa95 -r 85dc47afeac7 freeDiameter/cnxctx.c --- a/freeDiameter/cnxctx.c Tue Feb 23 11:42:26 2010 +0900 +++ b/freeDiameter/cnxctx.c Tue Feb 23 15:09:48 2010 +0900 @@ -509,13 +509,14 @@ 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; } diff -r c8ad11effa95 -r 85dc47afeac7 freeDiameter/sctps.c --- a/freeDiameter/sctps.c Tue Feb 23 11:42:26 2010 +0900 +++ b/freeDiameter/sctps.c Tue Feb 23 15:09:48 2010 +0900 @@ -114,6 +114,11 @@ } 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 @@ 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;