jl777 7 years ago
parent
commit
82776e9f6a
  1. 40
      iguana/exchanges/LP_nativeDEX.c

40
iguana/exchanges/LP_nativeDEX.c

@ -677,29 +677,35 @@ int32_t LP_reserved_msgs()
{ {
bits256 zero; int32_t n = 0; struct nn_pollfd pfd; bits256 zero; int32_t n = 0; struct nn_pollfd pfd;
memset(zero.bytes,0,sizeof(zero)); memset(zero.bytes,0,sizeof(zero));
portable_mutex_lock(&LP_reservedmutex); while ( 1 )
while ( num_Reserved_msgs > 0 )
{ {
memset(&pfd,0,sizeof(pfd)); portable_mutex_lock(&LP_reservedmutex);
pfd.fd = LP_mypubsock; if ( num_Reserved_msgs > 0 )
pfd.events = NN_POLLOUT; {
if ( nn_poll(&pfd,1,1) != 1 ) portable_mutex_unlock(&LP_reservedmutex);
break; memset(&pfd,0,sizeof(pfd));
num_Reserved_msgs--; pfd.fd = LP_mypubsock;
//printf("%d BROADCASTING RESERVED.(%s)\n",num_Reserved_msgs,Reserved_msgs[num_Reserved_msgs]); pfd.events = NN_POLLOUT;
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__ #ifdef __APPLE__
#endif #endif
LP_broadcast_message(LP_mypubsock,"","",zero,Reserved_msgs[num_Reserved_msgs]); LP_broadcast_message(LP_mypubsock,"","",zero,Reserved_msgs[num_Reserved_msgs]);
Reserved_msgs[num_Reserved_msgs] = 0; Reserved_msgs[num_Reserved_msgs] = 0;
/*#ifdef __APPLE__ /*#ifdef __APPLE__
usleep(5000); usleep(5000);
#else #else
usleep(3000); usleep(3000);
#endif*/ #endif*/
}
}
portable_mutex_unlock(&LP_reservedmutex);
if ( ++n > 0 ) if ( ++n > 0 )
break; break;
} }
portable_mutex_unlock(&LP_reservedmutex);
return(n); return(n);
} }

Loading…
Cancel
Save