Browse Source

Test

etomic
jl777 8 years ago
parent
commit
b27fa2fdc9
  1. 14
      iguana/exchanges/LP_network.c

14
iguana/exchanges/LP_network.c

@ -113,8 +113,6 @@ void queue_loop(void *ignore)
printf("LP_Q.%p next.%p prev.%p\n",LP_Q,LP_Q!=0?LP_Q->next:0,LP_Q!=0?LP_Q->prev:0); printf("LP_Q.%p next.%p prev.%p\n",LP_Q,LP_Q!=0?LP_Q->next:0,LP_Q!=0?LP_Q->prev:0);
DL_FOREACH_SAFE(LP_Q,ptr,tmp) DL_FOREACH_SAFE(LP_Q,ptr,tmp)
{ {
DL_DELETE(LP_Q,ptr);
LP_Qdequeued++;
if ( ptr->sock >= 0 ) if ( ptr->sock >= 0 )
{ {
if ( LP_sockcheck(ptr->sock) > 0 ) if ( LP_sockcheck(ptr->sock) > 0 )
@ -128,6 +126,9 @@ void queue_loop(void *ignore)
ptr->starttime = (uint32_t)time(NULL); ptr->starttime = (uint32_t)time(NULL);
else else
{ {
nonz++;
DL_DELETE(LP_Q,ptr);
LP_Qdequeued++;
free(ptr); free(ptr);
ptr = 0; ptr = 0;
} }
@ -140,6 +141,8 @@ void queue_loop(void *ignore)
{ {
nonz++; nonz++;
printf("found crc32.%u\n",ptr->crc32); printf("found crc32.%u\n",ptr->crc32);
LP_Qdequeued++;
DL_DELETE(LP_Q,ptr);
free(ptr); free(ptr);
ptr = 0; ptr = 0;
} }
@ -148,18 +151,21 @@ void queue_loop(void *ignore)
ptr->peerind++; ptr->peerind++;
if ( (ptr->sock= LP_peerindsock(&ptr->peerind)) < 0 ) if ( (ptr->sock= LP_peerindsock(&ptr->peerind)) < 0 )
{ {
nonz++;
printf("no more peers to try at peerind.%d %p Q_LP.%p\n",ptr->peerind,ptr,LP_Q); printf("no more peers to try at peerind.%d %p Q_LP.%p\n",ptr->peerind,ptr,LP_Q);
LP_Qdequeued++;
DL_DELETE(LP_Q,ptr);
free(ptr); free(ptr);
ptr = 0; ptr = 0;
} }
} }
} }
if ( ptr != 0 ) /*if ( ptr != 0 )
{ {
printf("reQ.%p: %u msglen.%d (+%d, -%d) -> %d\n",ptr,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);
DL_APPEND(LP_Q,ptr); DL_APPEND(LP_Q,ptr);
LP_Qenqueued++; LP_Qenqueued++;
} }*/
} }
portable_mutex_unlock(&LP_networkmutex); portable_mutex_unlock(&LP_networkmutex);
if ( nonz == 0 ) if ( nonz == 0 )

Loading…
Cancel
Save