aboutsummaryrefslogtreecommitdiff
path: root/src/stream
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-12-10 14:11:53 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-12-10 14:11:53 +0000
commit3ccfd30802db0ff457cecef92609aa21c4728a4c (patch)
tree04ec4b9b4aedbebed12779f8d0c943e39d2abdc3 /src/stream
parent97d68f4f7c1f9b37e92550ac74ba8fa4315a97c1 (diff)
downloadgnunet-3ccfd30802db0ff457cecef92609aa21c4728a4c.tar.gz
gnunet-3ccfd30802db0ff457cecef92609aa21c4728a4c.zip
fix 2672
Diffstat (limited to 'src/stream')
-rw-r--r--src/stream/stream_api.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/stream/stream_api.c b/src/stream/stream_api.c
index 60e7cfbd8..a0be54d43 100644
--- a/src/stream/stream_api.c
+++ b/src/stream/stream_api.c
@@ -2603,6 +2603,7 @@ handle_ack (struct GNUNET_STREAM_Socket *socket,
2603 ack_bitmap = GNUNET_ntohll (ack->bitmap); 2603 ack_bitmap = GNUNET_ntohll (ack->bitmap);
2604 for (; packet < GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH; packet++) 2604 for (; packet < GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH; packet++)
2605 { 2605 {
2606 if (NULL == socket->write_handle->messages[packet]) break;
2606 if (ackbitmap_is_bit_set (&ack_bitmap, ntohl 2607 if (ackbitmap_is_bit_set (&ack_bitmap, ntohl
2607 (socket->write_handle->messages[packet]->sequence_number) 2608 (socket->write_handle->messages[packet]->sequence_number)
2608 - ntohl (ack->base_sequence_number))) 2609 - ntohl (ack->base_sequence_number)))
@@ -2912,7 +2913,7 @@ tunnel_cleaner (void *cls,
2912 GNUNET_STATISTICS_update (socket->stat_handle, 2913 GNUNET_STATISTICS_update (socket->stat_handle,
2913 "inbound connections", -1, GNUNET_NO); 2914 "inbound connections", -1, GNUNET_NO);
2914 } 2915 }
2915 socket->status = GNUNET_STREAM_SHUTDOWN; 2916 socket->status = GNUNET_STREAM_SYSERR;
2916 /* Clear Transmit handles */ 2917 /* Clear Transmit handles */
2917 if (NULL != socket->transmit_handle) 2918 if (NULL != socket->transmit_handle)
2918 { 2919 {
@@ -2936,12 +2937,6 @@ tunnel_cleaner (void *cls,
2936 GNUNET_SCHEDULER_cancel (socket->control_retransmission_task_id); 2937 GNUNET_SCHEDULER_cancel (socket->control_retransmission_task_id);
2937 socket->control_retransmission_task_id = GNUNET_SCHEDULER_NO_TASK; 2938 socket->control_retransmission_task_id = GNUNET_SCHEDULER_NO_TASK;
2938 } 2939 }
2939 /* Clear Transmit handles */
2940 if (NULL != socket->transmit_handle)
2941 {
2942 GNUNET_MESH_notify_transmit_ready_cancel (socket->transmit_handle);
2943 socket->transmit_handle = NULL;
2944 }
2945 /* Clear existing message queue */ 2940 /* Clear existing message queue */
2946 while (NULL != (head = socket->queue_head)) { 2941 while (NULL != (head = socket->queue_head)) {
2947 GNUNET_CONTAINER_DLL_remove (socket->queue_head, 2942 GNUNET_CONTAINER_DLL_remove (socket->queue_head,
@@ -3437,9 +3432,10 @@ GNUNET_STREAM_listen_close (struct GNUNET_STREAM_ListenSocket *lsocket)
3437 * stream 3432 * stream
3438 * @param write_cont_cls the closure 3433 * @param write_cont_cls the closure
3439 * 3434 *
3440 * @return handle to cancel the operation; if a previous write is pending or 3435 * @return handle to cancel the operation; if a previous write is pending NULL
3441 * the stream has been shutdown for this operation then write_cont is 3436 * is returned. If the stream has been shutdown for this operation or
3442 * immediately called and NULL is returned. 3437 * is broken then write_cont is immediately called and NULL is
3438 * returned.
3443 */ 3439 */
3444struct GNUNET_STREAM_IOWriteHandle * 3440struct GNUNET_STREAM_IOWriteHandle *
3445GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket, 3441GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket,
@@ -3466,6 +3462,12 @@ GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket,
3466 GNUNET_break (0); 3462 GNUNET_break (0);
3467 return NULL; 3463 return NULL;
3468 } 3464 }
3465 if (NULL == socket->tunnel)
3466 {
3467 if (NULL != write_cont)
3468 write_cont (write_cont_cls, GNUNET_STREAM_SYSERR, 0);
3469 return NULL;
3470 }
3469 switch (socket->state) 3471 switch (socket->state)
3470 { 3472 {
3471 case STATE_TRANSMIT_CLOSED: 3473 case STATE_TRANSMIT_CLOSED:
@@ -3481,7 +3483,6 @@ GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket,
3481 case STATE_LISTEN: 3483 case STATE_LISTEN:
3482 case STATE_HELLO_WAIT: 3484 case STATE_HELLO_WAIT:
3483 if (NULL != write_cont) 3485 if (NULL != write_cont)
3484 /* FIXME: GNUNET_STREAM_SYSERR?? */
3485 write_cont (write_cont_cls, GNUNET_STREAM_SYSERR, 0); 3486 write_cont (write_cont_cls, GNUNET_STREAM_SYSERR, 0);
3486 LOG (GNUNET_ERROR_TYPE_DEBUG, 3487 LOG (GNUNET_ERROR_TYPE_DEBUG,
3487 "%s() END\n", __func__); 3488 "%s() END\n", __func__);