|
|
@ -441,15 +441,15 @@ int32_t swap_nn_send(int32_t sock,uint8_t *data,int32_t datalen,uint32_t flags,i |
|
|
|
int32_t LP_waitsend(char *statename,int32_t timeout,int32_t pairsock,struct basilisk_swap *swap,uint8_t *data,int32_t maxlen,int32_t (*verify)(struct basilisk_swap *swap,uint8_t *data,int32_t datalen),int32_t (*datagen)(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen)) |
|
|
|
{ |
|
|
|
int32_t datalen,sendlen,retval = -1; |
|
|
|
printf("waitsend.%s timeout.%d\n",statename,timeout); |
|
|
|
//printf("waitsend.%s timeout.%d\n",statename,timeout);
|
|
|
|
if ( LP_waitfor(pairsock,swap,timeout,verify) == 0 ) |
|
|
|
{ |
|
|
|
printf("waited for %s\n",statename); |
|
|
|
//printf("waited for %s\n",statename);
|
|
|
|
if ( (datalen= (*datagen)(swap,data,maxlen)) > 0 ) |
|
|
|
{ |
|
|
|
if ( (sendlen= swap_nn_send(pairsock,data,datalen,0,timeout)) == datalen ) |
|
|
|
{ |
|
|
|
printf("sent.%d after waitfor.%s\n",sendlen,statename); |
|
|
|
//printf("sent.%d after waitfor.%s\n",sendlen,statename);
|
|
|
|
retval = 0; |
|
|
|
} else printf("send %s error\n",statename); |
|
|
|
} else printf("%s datagen no data\n",statename); |
|
|
@ -460,13 +460,13 @@ int32_t LP_waitsend(char *statename,int32_t timeout,int32_t pairsock,struct basi |
|
|
|
int32_t LP_sendwait(char *statename,int32_t timeout,int32_t pairsock,struct basilisk_swap *swap,uint8_t *data,int32_t maxlen,int32_t (*verify)(struct basilisk_swap *swap,uint8_t *data,int32_t datalen),int32_t (*datagen)(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen)) |
|
|
|
{ |
|
|
|
int32_t datalen,sendlen,retval = -1; |
|
|
|
printf("sendwait.%s\n",statename); |
|
|
|
//printf("sendwait.%s\n",statename);
|
|
|
|
if ( (datalen= (*datagen)(swap,data,maxlen)) > 0 ) |
|
|
|
{ |
|
|
|
printf("generated %d for %s, timeout.%d\n",datalen,statename,timeout); |
|
|
|
//printf("generated %d for %s, timeout.%d\n",datalen,statename,timeout);
|
|
|
|
if ( (sendlen= swap_nn_send(pairsock,data,datalen,0,timeout)) == datalen ) |
|
|
|
{ |
|
|
|
printf("sendwait.%s sent %d\n",statename,sendlen); |
|
|
|
//printf("sendwait.%s sent %d\n",statename,sendlen);
|
|
|
|
if ( LP_waitfor(pairsock,swap,timeout,verify) == 0 ) |
|
|
|
{ |
|
|
|
//printf("waited! sendwait.%s sent %d\n",statename,sendlen);
|
|
|
|