/**
* Are we allowed to send to the service?
*/
- int allow_send;
+ unsigned int allow_send;
};
{
ch->ccn = ccn;
}
- ch->allow_send = GNUNET_NO;
return ch;
}
"Requesting Data: %u bytes\n",
th->size);
- GNUNET_assert (GNUNET_YES == th->channel->allow_send);
- th->channel->allow_send = GNUNET_NO;
+ GNUNET_assert (0 < th->channel->allow_send);
+ th->channel->allow_send--;
+ /* NOTE: we may be allowed to send another packet immediately,
+ albeit the current logic waits for the ACK. */
th->request_data_task = NULL;
th->channel->packet_size = 0;
remove_from_queue (th);
void *ctx;
ch = create_channel (h, ccn);
- ch->allow_send = GNUNET_NO;
ch->peer = GNUNET_PEER_intern (&msg->peer);
ch->cadet = h;
ch->ccn = ccn;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Got an ACK on channel %X!\n",
ntohl (ch->ccn.channel_of_client));
- ch->allow_send = GNUNET_YES;
+ ch->allow_send++;
if (0 < ch->packet_size)
{
struct GNUNET_CADET_TransmitHandle *th;
struct GNUNET_CADET_TransmitHandle *next;
+
LOG (GNUNET_ERROR_TYPE_DEBUG,
" pending data, sending %u bytes!\n",
ch->packet_size);
for (th = h->th_head; NULL != th; th = next)
{
next = th->next;
- if (th->channel == ch)
+ if ( (th->channel == ch) &&
+ (NULL == th->request_data_task) )
{
- GNUNET_assert (NULL == th->request_data_task);
- th->request_data_task = GNUNET_SCHEDULER_add_now (&request_data, th);
+ th->request_data_task
+ = GNUNET_SCHEDULER_add_now (&request_data,
+ th);
break;
}
}
msg->port = *port;
msg->peer = *peer;
msg->opt = htonl (options);
- ch->allow_send = GNUNET_NO;
GNUNET_MQ_send (h->mq,
env);
return ch;
LOG (GNUNET_ERROR_TYPE_DEBUG, " total size %u\n", th->size);
th->notify = notify;
th->notify_cls = notify_cls;
- if (GNUNET_YES == channel->allow_send)
+ if (0 != channel->allow_send)
th->request_data_task = GNUNET_SCHEDULER_add_now (&request_data, th);
else
add_to_queue (channel->cadet, th);