Browse Source

Test

etomic
jl777 8 years ago
parent
commit
c155340bf6
  1. 10
      iguana/exchanges/LP_network.c

10
iguana/exchanges/LP_network.c

@ -100,6 +100,7 @@ void _LP_sendqueueadd(int32_t sock,uint8_t *msg,int32_t msglen,int32_t peerind)
memcpy(ptr->msg,msg,msglen); memcpy(ptr->msg,msg,msglen);
DL_APPEND(LP_Q,ptr); DL_APPEND(LP_Q,ptr);
LP_Qenqueued++; LP_Qenqueued++;
printf("Q.%p\n",ptr);
} }
void queue_loop(void *ignore) void queue_loop(void *ignore)
@ -108,11 +109,11 @@ void queue_loop(void *ignore)
while ( 1 ) while ( 1 )
{ {
nonz = 0; nonz = 0;
portable_mutex_lock(&LP_networkmutex);
DL_FOREACH(LP_Q,ptr) DL_FOREACH(LP_Q,ptr)
{ {
portable_mutex_lock(&LP_networkmutex);
DL_DELETE(LP_Q,ptr); DL_DELETE(LP_Q,ptr);
portable_mutex_unlock(&LP_networkmutex); printf("deQ.%p\n",ptr);
LP_Qdequeued++; LP_Qdequeued++;
if ( ptr->sock >= 0 ) if ( ptr->sock >= 0 )
{ {
@ -153,13 +154,12 @@ void queue_loop(void *ignore)
} }
if ( ptr != 0 ) if ( ptr != 0 )
{ {
printf("reQ: qsent %u msglen.%d (+%d, -%d) -> %d\n",ptr->crc32,ptr->msglen,LP_Qenqueued,LP_Qdequeued,LP_Qenqueued-LP_Qdequeued); printf("reQ.%p: %u msglen.%d (+%d, -%d) -> %d\n",ptr,ptr->crc32,ptr->msglen,LP_Qenqueued,LP_Qdequeued,LP_Qenqueued-LP_Qdequeued);
portable_mutex_lock(&LP_networkmutex);
DL_APPEND(LP_Q,ptr); DL_APPEND(LP_Q,ptr);
portable_mutex_unlock(&LP_networkmutex);
LP_Qenqueued++; LP_Qenqueued++;
} }
} }
portable_mutex_unlock(&LP_networkmutex);
if ( nonz == 0 ) if ( nonz == 0 )
usleep(10000); usleep(10000);
} }

Loading…
Cancel
Save