Mercurial > hg > freeDiameter
changeset 1175:2da13c87baa7
Allow cancelation of thread in sctp_connectx when this function is not a cancelation point (bug of the system, seen on Ubuntu Precise at least)
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Mon, 03 Jun 2013 12:13:17 +0800 |
parents | b72836fb814b |
children | f0b328ea2fdb |
files | libfdcore/sctp.c |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libfdcore/sctp.c Mon Jun 03 12:05:37 2013 +0800 +++ b/libfdcore/sctp.c Mon Jun 03 12:13:17 2013 +0800 @@ -924,11 +924,15 @@ } #endif + /* Bug in some Linux kernel, the sctp_connectx is not a cancellation point. To avoid blocking freeDiameter, we allow async cancel here */ + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); #ifdef SCTP_CONNECTX_4_ARGS ret = sctp_connectx(*sock, sar.sa, count, NULL); #else /* SCTP_CONNECTX_4_ARGS */ ret = sctp_connectx(*sock, sar.sa, count); #endif /* SCTP_CONNECTX_4_ARGS */ + /* back to normal cancelation behabior */ + pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); if (ret < 0) { int lvl;