Mercurial > hg > freeDiameter
changeset 223:85dc47afeac7
Cleanup termination
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Tue, 23 Feb 2010 15:09:48 +0900 |
parents | c8ad11effa95 |
children | 3caac3cd359d |
files | freeDiameter/cnxctx.c freeDiameter/sctps.c |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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; }
--- 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;