|
|
@ -677,14 +677,18 @@ int32_t LP_reserved_msgs() |
|
|
|
{ |
|
|
|
bits256 zero; int32_t n = 0; struct nn_pollfd pfd; |
|
|
|
memset(zero.bytes,0,sizeof(zero)); |
|
|
|
while ( 1 ) |
|
|
|
{ |
|
|
|
portable_mutex_lock(&LP_reservedmutex); |
|
|
|
while ( num_Reserved_msgs > 0 ) |
|
|
|
if ( num_Reserved_msgs > 0 ) |
|
|
|
{ |
|
|
|
portable_mutex_unlock(&LP_reservedmutex); |
|
|
|
memset(&pfd,0,sizeof(pfd)); |
|
|
|
pfd.fd = LP_mypubsock; |
|
|
|
pfd.events = NN_POLLOUT; |
|
|
|
if ( nn_poll(&pfd,1,1) != 1 ) |
|
|
|
break; |
|
|
|
if ( nn_poll(&pfd,1,1) == 1 ) |
|
|
|
{ |
|
|
|
portable_mutex_lock(&LP_reservedmutex); |
|
|
|
num_Reserved_msgs--; |
|
|
|
//printf("%d BROADCASTING RESERVED.(%s)\n",num_Reserved_msgs,Reserved_msgs[num_Reserved_msgs]);
|
|
|
|
#ifdef __APPLE__ |
|
|
@ -696,10 +700,12 @@ int32_t LP_reserved_msgs() |
|
|
|
#else |
|
|
|
usleep(3000); |
|
|
|
#endif*/ |
|
|
|
} |
|
|
|
} |
|
|
|
portable_mutex_unlock(&LP_reservedmutex); |
|
|
|
if ( ++n > 0 ) |
|
|
|
break; |
|
|
|
} |
|
|
|
portable_mutex_unlock(&LP_reservedmutex); |
|
|
|
return(n); |
|
|
|
} |
|
|
|
|
|
|
|