From: Sree Harsha Totakura Date: Sat, 10 Mar 2012 09:13:20 +0000 (+0000) Subject: fixed retransmission task X-Git-Tag: initial-import-from-subversion-38251~14310 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=532493cd0d5c9aaf4a169e6f609d1c91dbc5b677;p=oweals%2Fgnunet.git fixed retransmission task --- diff --git a/src/stream/stream_api.c b/src/stream/stream_api.c index bb50f69bc..d488b4c80 100644 --- a/src/stream/stream_api.c +++ b/src/stream/stream_api.c @@ -791,10 +791,12 @@ write_data (struct GNUNET_STREAM_Socket *socket) packet++; } - GNUNET_SCHEDULER_add_delayed - (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5), - &retransmission_timeout_task, - socket); + if (GNUNET_SCHEDULER_NO_TASK == socket->retransmission_timeout_task_id) + socket->retransmission_timeout_task_id = + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply + (GNUNET_TIME_UNIT_SECONDS, 5), + &retransmission_timeout_task, + socket); } @@ -1837,6 +1839,11 @@ handle_ack (struct GNUNET_STREAM_Socket *socket, } /* FIXME: include the case when write_handle is cancelled - ignore the acks */ + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "%x: Received DATA_ACK from %x\n", + socket->our_id, + socket->other_peer); /* Cancel the retransmission task */ if (GNUNET_SCHEDULER_NO_TASK != socket->retransmission_timeout_task_id) @@ -1845,7 +1852,7 @@ handle_ack (struct GNUNET_STREAM_Socket *socket, socket->retransmission_timeout_task_id = GNUNET_SCHEDULER_NO_TASK; } - + socket->write_handle->ack_bitmap = GNUNET_ntohll (ack->bitmap); socket->receiver_window_available = ntohl (ack->receive_window_remaining); @@ -1868,7 +1875,6 @@ handle_ack (struct GNUNET_STREAM_Socket *socket, } else /* We have to call the write continuation callback now */ { - /* Free the packets */ for (packet=0; packet < 64; packet++) { @@ -1879,6 +1885,9 @@ handle_ack (struct GNUNET_STREAM_Socket *socket, (socket->write_handle->write_cont_cls, socket->status, socket->write_handle->size); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "%x: Write completion callback completed\n", + socket->our_id); /* We are done with the write handle - Freeing it */ GNUNET_free (socket->write_handle); socket->write_handle = NULL; diff --git a/src/stream/test_stream_local.c b/src/stream/test_stream_local.c index af4e057d7..125fc6df8 100644 --- a/src/stream/test_stream_local.c +++ b/src/stream/test_stream_local.c @@ -204,6 +204,9 @@ write_completion (void *cls, GNUNET_assert (size <= strlen (data)); peer->bytes_wrote += size; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Writing completed\n"); + if (peer->bytes_wrote < strlen(data)) /* Have more data to send */ { peer->io_write_handle = @@ -319,7 +322,7 @@ input_processor (void *cls, { GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); } - } + } return size; }