comparison freeDiameter/sctps.c @ 223:85dc47afeac7

Cleanup termination
author Sebastien Decugis <sdecugis@nict.go.jp>
date Tue, 23 Feb 2010 15:09:48 +0900
parents d8e3336e4744
children 80a7e65167c4
comparison
equal deleted inserted replaced
222:c8ad11effa95 223:85dc47afeac7
112 } 112 }
113 113
114 } while (conn->cc_loop); 114 } while (conn->cc_loop);
115 115
116 out: 116 out:
117 /* Signal termination of the connection to all decipher threads */
118 for (strid = 0; strid < conn->cc_sctp_para.pairs; strid++) {
119 if (conn->cc_sctps_data.array[strid].raw_recv)
120 CHECK_FCT_DO(fd_event_send(conn->cc_sctps_data.array[strid].raw_recv, FDEVP_CNX_ERROR, 0, NULL), goto fatal );
121 }
117 TRACE_DEBUG(FULL, "Thread terminated"); 122 TRACE_DEBUG(FULL, "Thread terminated");
118 return NULL; 123 return NULL;
119 124
120 fatal: 125 fatal:
121 /* An unrecoverable error occurred, stop the daemon */ 126 /* An unrecoverable error occurred, stop the daemon */
178 183
179 /* If we don't have data available now, pull new message from the fifo -- this is blocking (until the queue is destroyed) */ 184 /* If we don't have data available now, pull new message from the fifo -- this is blocking (until the queue is destroyed) */
180 if (!ctx->partial.buf) { 185 if (!ctx->partial.buf) {
181 int ev; 186 int ev;
182 CHECK_FCT_DO( errno = fd_event_get(ctx->raw_recv, &ev, &ctx->partial.bufsz, (void *)&ctx->partial.buf), return -1 ); 187 CHECK_FCT_DO( errno = fd_event_get(ctx->raw_recv, &ev, &ctx->partial.bufsz, (void *)&ctx->partial.buf), return -1 );
183 ASSERT( ev == FDEVP_CNX_MSG_RECV ); 188 if (ev == FDEVP_CNX_ERROR)
189 return 0; /* connection closed */
184 } 190 }
185 191
186 pulled = ctx->partial.bufsz - ctx->partial.offset; 192 pulled = ctx->partial.bufsz - ctx->partial.offset;
187 if (pulled <= len) { 193 if (pulled <= len) {
188 emptied = 1; 194 emptied = 1;
"Welcome to our mercurial repository"