Mercurial > hg > freeDiameter
comparison freeDiameter/sctps.c @ 454:f1484823cb4a
Small hack which might spear some concurrency problems and is quite harmless
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Thu, 29 Jul 2010 16:11:12 +0900 |
parents | 26aafbbc1640 |
children | 7250e91f0662 |
comparison
equal
deleted
inserted
replaced
453:9a8b3178a7a7 | 454:f1484823cb4a |
---|---|
84 ASSERT( conn->cc_proto == IPPROTO_SCTP ); | 84 ASSERT( conn->cc_proto == IPPROTO_SCTP ); |
85 ASSERT( Target_Queue(conn) ); | 85 ASSERT( Target_Queue(conn) ); |
86 ASSERT( conn->cc_sctps_data.array ); | 86 ASSERT( conn->cc_sctps_data.array ); |
87 | 87 |
88 do { | 88 do { |
89 fd_cpu_flush_cache(); | |
89 CHECK_FCT_DO( fd_sctp_recvmeta(conn->cc_socket, &strid, &buf, &bufsz, &event, &conn->cc_status), goto fatal ); | 90 CHECK_FCT_DO( fd_sctp_recvmeta(conn->cc_socket, &strid, &buf, &bufsz, &event, &conn->cc_status), goto fatal ); |
90 switch (event) { | 91 switch (event) { |
91 case FDEVP_CNX_MSG_RECV: | 92 case FDEVP_CNX_MSG_RECV: |
92 /* Demux this message to the appropriate fifo, another thread will pull, gnutls process, and send to target queue */ | 93 /* Demux this message to the appropriate fifo, another thread will pull, gnutls process, and send to target queue */ |
93 if (strid < conn->cc_sctp_para.pairs) { | 94 if (strid < conn->cc_sctp_para.pairs) { |
168 struct sctps_ctx * ctx = (struct sctps_ctx *) tr; | 169 struct sctps_ctx * ctx = (struct sctps_ctx *) tr; |
169 | 170 |
170 TRACE_ENTRY("%p %p %zd", tr, data, len); | 171 TRACE_ENTRY("%p %p %zd", tr, data, len); |
171 CHECK_PARAMS_DO( tr && data, { errno = EINVAL; return -1; } ); | 172 CHECK_PARAMS_DO( tr && data, { errno = EINVAL; return -1; } ); |
172 | 173 |
174 fd_cpu_flush_cache(); | |
173 CHECK_FCT_DO( fd_sctp_sendstr(ctx->parent->cc_socket, ctx->strid, (uint8_t *)data, len, &ctx->parent->cc_status), /* errno is already set */ return -1 ); | 175 CHECK_FCT_DO( fd_sctp_sendstr(ctx->parent->cc_socket, ctx->strid, (uint8_t *)data, len, &ctx->parent->cc_status), /* errno is already set */ return -1 ); |
174 | 176 |
175 return len; | 177 return len; |
176 } | 178 } |
177 | 179 |
617 | 619 |
618 CHECK_PARAMS_DO( conn && conn->cc_sctps_data.array, return ); | 620 CHECK_PARAMS_DO( conn && conn->cc_sctps_data.array, return ); |
619 | 621 |
620 /* End all TLS sessions, in series (not as efficient as paralel, but simpler) */ | 622 /* End all TLS sessions, in series (not as efficient as paralel, but simpler) */ |
621 for (i = 1; i < conn->cc_sctp_para.pairs; i++) { | 623 for (i = 1; i < conn->cc_sctp_para.pairs; i++) { |
624 fd_cpu_flush_cache(); | |
622 if ( ! (conn->cc_status & CC_STATUS_ERROR)) { | 625 if ( ! (conn->cc_status & CC_STATUS_ERROR)) { |
623 CHECK_GNUTLS_DO( gnutls_bye(conn->cc_sctps_data.array[i].session, GNUTLS_SHUT_WR), fd_cnx_markerror(conn) ); | 626 CHECK_GNUTLS_DO( gnutls_bye(conn->cc_sctps_data.array[i].session, GNUTLS_SHUT_WR), fd_cnx_markerror(conn) ); |
624 } | 627 } |
625 } | 628 } |
626 } | 629 } |