aboutsummaryrefslogtreecommitdiff
path: root/src/stream/stream_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-20 12:41:35 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-20 12:41:35 +0000
commitbd8ba044e2d6d9878b6a24eceb89b29965d08cf3 (patch)
treeb5152e53173e0f8dceb4fdd725d460b5f2b3e6b6 /src/stream/stream_api.c
parent550e15b99d7fbe50f7b2e7d695f87ae3a3d5f57d (diff)
downloadgnunet-bd8ba044e2d6d9878b6a24eceb89b29965d08cf3.tar.gz
gnunet-bd8ba044e2d6d9878b6a24eceb89b29965d08cf3.zip
-working on stream
Diffstat (limited to 'src/stream/stream_api.c')
-rw-r--r--src/stream/stream_api.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/stream/stream_api.c b/src/stream/stream_api.c
index fda1810f6..e27f4df1f 100644
--- a/src/stream/stream_api.c
+++ b/src/stream/stream_api.c
@@ -702,6 +702,7 @@ send_ack_notify (void *cls, size_t size, void *buf)
702 return size; 702 return size;
703} 703}
704 704
705
705/** 706/**
706 * Writes data using the given socket. The amount of data written is limited by 707 * Writes data using the given socket. The amount of data written is limited by
707 * the receiver_window_size 708 * the receiver_window_size
@@ -711,6 +712,7 @@ send_ack_notify (void *cls, size_t size, void *buf)
711static void 712static void
712write_data (struct GNUNET_STREAM_Socket *socket); 713write_data (struct GNUNET_STREAM_Socket *socket);
713 714
715
714/** 716/**
715 * Task for retransmitting data messages if they aren't ACK before their ack 717 * Task for retransmitting data messages if they aren't ACK before their ack
716 * deadline 718 * deadline
@@ -1294,7 +1296,6 @@ set_state_established (void *cls,
1294 socket->write_offset = 0; 1296 socket->write_offset = 0;
1295 socket->read_offset = 0; 1297 socket->read_offset = 0;
1296 socket->state = STATE_ESTABLISHED; 1298 socket->state = STATE_ESTABLISHED;
1297 /* FIXME: What if listen_cb is NULL */
1298 if (NULL != socket->lsocket) 1299 if (NULL != socket->lsocket)
1299 { 1300 {
1300 LOG (GNUNET_ERROR_TYPE_DEBUG, 1301 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1306,12 +1307,12 @@ set_state_established (void *cls,
1306 &socket->other_peer)) 1307 &socket->other_peer))
1307 { 1308 {
1308 socket->state = STATE_CLOSED; 1309 socket->state = STATE_CLOSED;
1309 /* FIXME: We should close in a decent way */ 1310 /* FIXME: We should close in a decent way (send RST) */
1310 GNUNET_MESH_tunnel_destroy (socket->tunnel); /* Destroy the tunnel */ 1311 GNUNET_MESH_tunnel_destroy (socket->tunnel); /* Destroy the tunnel */
1311 GNUNET_free (socket); 1312 GNUNET_free (socket);
1312 } 1313 }
1313 } 1314 }
1314 else if (socket->open_cb) 1315 else if (NULL != socket->open_cb)
1315 socket->open_cb (socket->open_cls, socket); 1316 socket->open_cb (socket->open_cls, socket);
1316} 1317}
1317 1318
@@ -1404,6 +1405,7 @@ set_state_closed (void *cls,
1404 socket->state = STATE_CLOSED; 1405 socket->state = STATE_CLOSED;
1405} 1406}
1406 1407
1408
1407/** 1409/**
1408 * Returns a new HelloAckMessage. Also sets the write sequence number for the 1410 * Returns a new HelloAckMessage. Also sets the write sequence number for the
1409 * socket 1411 * socket
@@ -3068,7 +3070,6 @@ GNUNET_STREAM_shutdown_cancel (struct GNUNET_STREAM_ShutdownHandle *handle)
3068 if (GNUNET_SCHEDULER_NO_TASK != handle->close_msg_retransmission_task_id) 3070 if (GNUNET_SCHEDULER_NO_TASK != handle->close_msg_retransmission_task_id)
3069 GNUNET_SCHEDULER_cancel (handle->close_msg_retransmission_task_id); 3071 GNUNET_SCHEDULER_cancel (handle->close_msg_retransmission_task_id);
3070 GNUNET_free (handle); 3072 GNUNET_free (handle);
3071 return;
3072} 3073}
3073 3074
3074 3075
@@ -3180,6 +3181,7 @@ GNUNET_STREAM_listen (const struct GNUNET_CONFIGURATION_Handle *cfg,
3180 enum GNUNET_STREAM_Option option; 3181 enum GNUNET_STREAM_Option option;
3181 va_list vargs; 3182 va_list vargs;
3182 3183
3184 GNUNET_assert (NULL != listen_cb);
3183 lsocket = GNUNET_malloc (sizeof (struct GNUNET_STREAM_ListenSocket)); 3185 lsocket = GNUNET_malloc (sizeof (struct GNUNET_STREAM_ListenSocket));
3184 lsocket->cfg = GNUNET_CONFIGURATION_dup (cfg); 3186 lsocket->cfg = GNUNET_CONFIGURATION_dup (cfg);
3185 lsocket->lockmanager = GNUNET_LOCKMANAGER_connect (lsocket->cfg); 3187 lsocket->lockmanager = GNUNET_LOCKMANAGER_connect (lsocket->cfg);
@@ -3376,7 +3378,6 @@ GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket,
3376} 3378}
3377 3379
3378 3380
3379
3380/** 3381/**
3381 * Tries to read data from the stream. 3382 * Tries to read data from the stream.
3382 * 3383 *
@@ -3479,7 +3480,6 @@ GNUNET_STREAM_io_write_cancel (struct GNUNET_STREAM_IOWriteHandle *ioh)
3479 3480
3480 GNUNET_free (socket->write_handle); 3481 GNUNET_free (socket->write_handle);
3481 socket->write_handle = NULL; 3482 socket->write_handle = NULL;
3482 return;
3483} 3483}
3484 3484
3485 3485
@@ -3491,5 +3491,7 @@ GNUNET_STREAM_io_write_cancel (struct GNUNET_STREAM_IOWriteHandle *ioh)
3491void 3491void
3492GNUNET_STREAM_io_read_cancel (struct GNUNET_STREAM_IOReadHandle *ioh) 3492GNUNET_STREAM_io_read_cancel (struct GNUNET_STREAM_IOReadHandle *ioh)
3493{ 3493{
3494 return; 3494 // FIXME: do stuff
3495} 3495}
3496
3497/* end of stream_api.c */