# HG changeset patch # User Sebastien Decugis # Date 1370232797 -28800 # Node ID 2da13c87baa7660b2ac47b2bff7565b1d7a03d71 # Parent b72836fb814b43aee3c86c885848b8762960ff7a 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) diff -r b72836fb814b -r 2da13c87baa7 libfdcore/sctp.c --- 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;