diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-12-11 11:21:31 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-12-11 11:21:31 +0000 |
commit | c70d10589c4189a255066032bdd1d72204641247 (patch) | |
tree | 4f50f90fb12cab8825f0d3aec975ba591b614886 | |
parent | 77e9e4a935bc9109365afebf00a4d88a694973ed (diff) | |
download | gnunet-c70d10589c4189a255066032bdd1d72204641247.tar.gz gnunet-c70d10589c4189a255066032bdd1d72204641247.zip |
- doxygen
-rw-r--r-- | src/include/gnunet_stream_lib.h | 10 | ||||
-rw-r--r-- | src/stream/stream_api.c | 41 |
2 files changed, 30 insertions, 21 deletions
diff --git a/src/include/gnunet_stream_lib.h b/src/include/gnunet_stream_lib.h index 8a1f22f47..0acede1ac 100644 --- a/src/include/gnunet_stream_lib.h +++ b/src/include/gnunet_stream_lib.h | |||
@@ -354,7 +354,7 @@ typedef size_t (*GNUNET_STREAM_DataProcessor) (void *cls, | |||
354 | * @param timeout the timeout period | 354 | * @param timeout the timeout period |
355 | * @param proc function to call with data (once only) | 355 | * @param proc function to call with data (once only) |
356 | * @param proc_cls the closure for proc | 356 | * @param proc_cls the closure for proc |
357 | * @return handle to cancel the operation; NULL is returned if: the stream has | 357 | * @return handle to cancel the operation; NULL is returned if the stream has |
358 | * been shutdown for this type of opeartion (the DataProcessor is | 358 | * been shutdown for this type of opeartion (the DataProcessor is |
359 | * immediately called with GNUNET_STREAM_SHUTDOWN as status) | 359 | * immediately called with GNUNET_STREAM_SHUTDOWN as status) |
360 | */ | 360 | */ |
@@ -380,19 +380,19 @@ GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket, | |||
380 | * used before shutting down transmission from our side or before closing the | 380 | * used before shutting down transmission from our side or before closing the |
381 | * socket. | 381 | * socket. |
382 | * | 382 | * |
383 | * @param ioh handle to operation to cancel | 383 | * @param wh write operation handle to cancel |
384 | */ | 384 | */ |
385 | void | 385 | void |
386 | GNUNET_STREAM_write_cancel (struct GNUNET_STREAM_WriteHandle *iowh); | 386 | GNUNET_STREAM_write_cancel (struct GNUNET_STREAM_WriteHandle *wh); |
387 | 387 | ||
388 | 388 | ||
389 | /** | 389 | /** |
390 | * Cancel pending read operation. | 390 | * Cancel pending read operation. |
391 | * | 391 | * |
392 | * @param ioh handle to operation to cancel | 392 | * @param rh read operation handle to cancel |
393 | */ | 393 | */ |
394 | void | 394 | void |
395 | GNUNET_STREAM_read_cancel (struct GNUNET_STREAM_ReadHandle *iorh); | 395 | GNUNET_STREAM_read_cancel (struct GNUNET_STREAM_ReadHandle *rh); |
396 | 396 | ||
397 | 397 | ||
398 | #if 0 | 398 | #if 0 |
diff --git a/src/stream/stream_api.c b/src/stream/stream_api.c index 0083e63fb..498d64d81 100644 --- a/src/stream/stream_api.c +++ b/src/stream/stream_api.c | |||
@@ -3616,12 +3616,9 @@ probe_data_availability (void *cls, | |||
3616 | * @param timeout the timeout period | 3616 | * @param timeout the timeout period |
3617 | * @param proc function to call with data (once only) | 3617 | * @param proc function to call with data (once only) |
3618 | * @param proc_cls the closure for proc | 3618 | * @param proc_cls the closure for proc |
3619 | * | 3619 | * @return handle to cancel the operation; NULL is returned if the stream has |
3620 | * @return handle to cancel the operation; NULL is returned if: the stream has | ||
3621 | * been shutdown for this type of opeartion (the DataProcessor is | 3620 | * been shutdown for this type of opeartion (the DataProcessor is |
3622 | * immediately called with GNUNET_STREAM_SHUTDOWN as status) OR another | 3621 | * immediately called with GNUNET_STREAM_SHUTDOWN as status) |
3623 | * read handle is present (only one read handle per socket is present | ||
3624 | * at any time) | ||
3625 | */ | 3622 | */ |
3626 | struct GNUNET_STREAM_ReadHandle * | 3623 | struct GNUNET_STREAM_ReadHandle * |
3627 | GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket, | 3624 | GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket, |
@@ -3674,18 +3671,30 @@ GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket, | |||
3674 | 3671 | ||
3675 | 3672 | ||
3676 | /** | 3673 | /** |
3677 | * Cancel pending write operation. | 3674 | * Cancels pending write operation. Also cancels packet retransmissions which |
3675 | * may have resulted otherwise. | ||
3676 | * | ||
3677 | * CAUTION: Normally a write operation is considered successful if the data | ||
3678 | * given to it is sent and acknowledged by the receiver. As data is divided | ||
3679 | * into packets, it is possible that not all packets are received by the | ||
3680 | * receiver. Any missing packets are then retransmitted till the receiver | ||
3681 | * acknowledges all packets or until a timeout . During this scenario if the | ||
3682 | * write operation is cancelled all such retransmissions are also | ||
3683 | * cancelled. This may leave the receiver's receive buffer incompletely filled | ||
3684 | * as some missing packets are never retransmitted. So this operation should be | ||
3685 | * used before shutting down transmission from our side or before closing the | ||
3686 | * socket. | ||
3678 | * | 3687 | * |
3679 | * @param ioh handle to operation to cancel | 3688 | * @param wh write operation handle to cancel |
3680 | */ | 3689 | */ |
3681 | void | 3690 | void |
3682 | GNUNET_STREAM_write_cancel (struct GNUNET_STREAM_WriteHandle *ioh) | 3691 | GNUNET_STREAM_write_cancel (struct GNUNET_STREAM_WriteHandle *wh) |
3683 | { | 3692 | { |
3684 | struct GNUNET_STREAM_Socket *socket = ioh->socket; | 3693 | struct GNUNET_STREAM_Socket *socket = wh->socket; |
3685 | unsigned int packet; | 3694 | unsigned int packet; |
3686 | 3695 | ||
3687 | GNUNET_assert (NULL != socket->write_handle); | 3696 | GNUNET_assert (NULL != socket->write_handle); |
3688 | GNUNET_assert (socket->write_handle == ioh); | 3697 | GNUNET_assert (socket->write_handle == wh); |
3689 | if (GNUNET_SCHEDULER_NO_TASK != socket->data_retransmission_task_id) | 3698 | if (GNUNET_SCHEDULER_NO_TASK != socket->data_retransmission_task_id) |
3690 | { | 3699 | { |
3691 | GNUNET_SCHEDULER_cancel (socket->data_retransmission_task_id); | 3700 | GNUNET_SCHEDULER_cancel (socket->data_retransmission_task_id); |
@@ -3693,8 +3702,8 @@ GNUNET_STREAM_write_cancel (struct GNUNET_STREAM_WriteHandle *ioh) | |||
3693 | } | 3702 | } |
3694 | for (packet=0; packet < GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH; packet++) | 3703 | for (packet=0; packet < GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH; packet++) |
3695 | { | 3704 | { |
3696 | if (NULL == ioh->messages[packet]) break; | 3705 | if (NULL == wh->messages[packet]) break; |
3697 | GNUNET_free (ioh->messages[packet]); | 3706 | GNUNET_free (wh->messages[packet]); |
3698 | } | 3707 | } |
3699 | GNUNET_free (socket->write_handle); | 3708 | GNUNET_free (socket->write_handle); |
3700 | socket->write_handle = NULL; | 3709 | socket->write_handle = NULL; |
@@ -3704,16 +3713,16 @@ GNUNET_STREAM_write_cancel (struct GNUNET_STREAM_WriteHandle *ioh) | |||
3704 | /** | 3713 | /** |
3705 | * Cancel pending read operation. | 3714 | * Cancel pending read operation. |
3706 | * | 3715 | * |
3707 | * @param ioh handle to operation to cancel | 3716 | * @param rh read operation handle to cancel |
3708 | */ | 3717 | */ |
3709 | void | 3718 | void |
3710 | GNUNET_STREAM_read_cancel (struct GNUNET_STREAM_ReadHandle *ioh) | 3719 | GNUNET_STREAM_read_cancel (struct GNUNET_STREAM_ReadHandle *rh) |
3711 | { | 3720 | { |
3712 | struct GNUNET_STREAM_Socket *socket; | 3721 | struct GNUNET_STREAM_Socket *socket; |
3713 | 3722 | ||
3714 | socket = ioh->socket; | 3723 | socket = rh->socket; |
3715 | GNUNET_assert (NULL != socket->read_handle); | 3724 | GNUNET_assert (NULL != socket->read_handle); |
3716 | GNUNET_assert (ioh == socket->read_handle); | 3725 | GNUNET_assert (rh == socket->read_handle); |
3717 | cleanup_read_handle (socket); | 3726 | cleanup_read_handle (socket); |
3718 | } | 3727 | } |
3719 | 3728 | ||