*/
void *copy_buffer;
+ /**
+ * Task identifier for the read io timeout task
+ */
+ GNUNET_SCHEDULER_TaskIdentifier read_io_timeout_task;
+
/**
* The state of the protocol associated with this socket
*/
valid_read_size = socket->copy_buffer_size - socket->copy_buffer_read_offset;
GNUNET_assert (0 != valid_read_size);
+ /* Cancel the read_io_timeout_task */
+ GNUNET_SCHEDULER_cancel (socket->read_io_timeout_task);
+ /* Call the data processor */
read_size = socket->read_handle->proc (socket->read_handle->proc_cls,
socket->status,
socket->copy_buffer
}
+
+/**
+ * Cancels the existing read io handle
+ *
+ * @param cls the closure from the SCHEDULER call
+ * @param tc the task context
+ */
+static void
+cancel_read_io (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct GNUNET_STREAM_Socket *socket = cls;
+
+ GNUNET_assert (NULL != socket->read_handle);
+
+ GNUNET_free (socket->read_handle);
+ socket->read_handle = NULL;
+}
+
+
/**
* Handler for DATA messages; Same for both client and server
*
else
prepare_buffer_for_read (socket);
+ socket->read_io_timeout_task = GNUNET_SCHEDULER_add_delayed (timeout,
+ &cancel_read_io,
+ socket);
+
return read_handle;
}