[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25357 - in gnunet/src: fs include stream
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25357 - in gnunet/src: fs include stream |
Date: |
Mon, 10 Dec 2012 15:11:53 +0100 |
Author: harsha
Date: 2012-12-10 15:11:53 +0100 (Mon, 10 Dec 2012)
New Revision: 25357
Modified:
gnunet/src/fs/gnunet-service-fs_stream.c
gnunet/src/include/gnunet_stream_lib.h
gnunet/src/stream/stream_api.c
Log:
fix 2672
Modified: gnunet/src/fs/gnunet-service-fs_stream.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_stream.c 2012-12-10 13:53:12 UTC (rev
25356)
+++ gnunet/src/fs/gnunet-service-fs_stream.c 2012-12-10 14:11:53 UTC (rev
25357)
@@ -1049,7 +1049,6 @@
case GNUNET_STREAM_TIMEOUT:
case GNUNET_STREAM_SHUTDOWN:
case GNUNET_STREAM_SYSERR:
- case GNUNET_STREAM_BROKEN:
terminate_stream_async (sc);
return size;
default:
Modified: gnunet/src/include/gnunet_stream_lib.h
===================================================================
--- gnunet/src/include/gnunet_stream_lib.h 2012-12-10 13:53:12 UTC (rev
25356)
+++ gnunet/src/include/gnunet_stream_lib.h 2012-12-10 14:11:53 UTC (rev
25357)
@@ -46,29 +46,23 @@
/**
* All previous read/write operations are successfully done
*/
- GNUNET_STREAM_OK = 0,
+ GNUNET_STREAM_OK,
/**
* A timeout occured while reading/writing the stream
*/
- GNUNET_STREAM_TIMEOUT = 1,
+ GNUNET_STREAM_TIMEOUT,
/**
* Other side has shutdown the socket for this type of operation
* (reading/writing)
*/
- GNUNET_STREAM_SHUTDOWN = 2,
+ GNUNET_STREAM_SHUTDOWN,
/**
* A serious error occured while operating on this stream
*/
- GNUNET_STREAM_SYSERR = 3,
-
- /**
- * An error resulted in an unusable stream
- * FIXME: status code unused?
- */
- GNUNET_STREAM_BROKEN
+ GNUNET_STREAM_SYSERR
};
/**
@@ -279,9 +273,13 @@
*
* @param cls the closure from GNUNET_STREAM_write
* @param status the status of the stream at the time this function is called;
- * GNUNET_OK if writing to stream was completed successfully,
+ * GNUNET_STREAM_OK if writing to stream was completed successfully;
+ * GNUNET_STREAM_TIMEOUT if the given data is not sent successfully
+ * (this doesn't mean that the data is never sent, the receiver may
+ * have read the data but its ACKs may have been lost);
* GNUNET_STREAM_SHUTDOWN if the stream is shutdown for writing in the
- * mean time.
+ * mean time; GNUNET_STREAM_SYSERR if the stream is broken and cannot
+ * be processed.
* @param size the number of bytes written
*/
typedef void (*GNUNET_STREAM_CompletionContinuation) (void *cls,
@@ -315,9 +313,10 @@
* stream
* @param write_cont_cls the closure
*
- * @return handle to cancel the operation; if a previous write is pending or
- * the stream has been shutdown for this operation then write_cont is
- * immediately called and NULL is returned.
+ * @return handle to cancel the operation; if a previous write is pending NULL
+ * is returned. If the stream has been shutdown for this operation or
+ * is broken then write_cont is immediately called and NULL is
+ * returned.
*/
struct GNUNET_STREAM_IOWriteHandle *
GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket,
Modified: gnunet/src/stream/stream_api.c
===================================================================
--- gnunet/src/stream/stream_api.c 2012-12-10 13:53:12 UTC (rev 25356)
+++ gnunet/src/stream/stream_api.c 2012-12-10 14:11:53 UTC (rev 25357)
@@ -2603,6 +2603,7 @@
ack_bitmap = GNUNET_ntohll (ack->bitmap);
for (; packet < GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH; packet++)
{
+ if (NULL == socket->write_handle->messages[packet]) break;
if (ackbitmap_is_bit_set (&ack_bitmap, ntohl
(socket->write_handle->messages[packet]->sequence_number)
- ntohl (ack->base_sequence_number)))
@@ -2912,7 +2913,7 @@
GNUNET_STATISTICS_update (socket->stat_handle,
"inbound connections", -1, GNUNET_NO);
}
- socket->status = GNUNET_STREAM_SHUTDOWN;
+ socket->status = GNUNET_STREAM_SYSERR;
/* Clear Transmit handles */
if (NULL != socket->transmit_handle)
{
@@ -2936,12 +2937,6 @@
GNUNET_SCHEDULER_cancel (socket->control_retransmission_task_id);
socket->control_retransmission_task_id = GNUNET_SCHEDULER_NO_TASK;
}
- /* Clear Transmit handles */
- if (NULL != socket->transmit_handle)
- {
- GNUNET_MESH_notify_transmit_ready_cancel (socket->transmit_handle);
- socket->transmit_handle = NULL;
- }
/* Clear existing message queue */
while (NULL != (head = socket->queue_head)) {
GNUNET_CONTAINER_DLL_remove (socket->queue_head,
@@ -3437,9 +3432,10 @@
* stream
* @param write_cont_cls the closure
*
- * @return handle to cancel the operation; if a previous write is pending or
- * the stream has been shutdown for this operation then write_cont is
- * immediately called and NULL is returned.
+ * @return handle to cancel the operation; if a previous write is pending NULL
+ * is returned. If the stream has been shutdown for this operation or
+ * is broken then write_cont is immediately called and NULL is
+ * returned.
*/
struct GNUNET_STREAM_IOWriteHandle *
GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket,
@@ -3466,6 +3462,12 @@
GNUNET_break (0);
return NULL;
}
+ if (NULL == socket->tunnel)
+ {
+ if (NULL != write_cont)
+ write_cont (write_cont_cls, GNUNET_STREAM_SYSERR, 0);
+ return NULL;
+ }
switch (socket->state)
{
case STATE_TRANSMIT_CLOSED:
@@ -3481,7 +3483,6 @@
case STATE_LISTEN:
case STATE_HELLO_WAIT:
if (NULL != write_cont)
- /* FIXME: GNUNET_STREAM_SYSERR?? */
write_cont (write_cont_cls, GNUNET_STREAM_SYSERR, 0);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"%s() END\n", __func__);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25357 - in gnunet/src: fs include stream,
gnunet <=