/**
* A serious error occured while operating on this stream
*/
- GNUNET_STREAM_SYSERR = 3
+ GNUNET_STREAM_SYSERR = 3,
+
+ /**
+ * An error resulted in an unusable stream
+ */
+ GNUNET_STREAM_BROKEN
};
/**
/**
- * Shutdown the stream for reading or writing (man 2 shutdown).
+ * Shutdown the stream for reading or writing (similar to man 2 shutdown).
*
* @param socket the stream socket
- * @param opertion SHUT_RD, SHUT_WR or SHUT_RDWR
+ * @param operation SHUT_RD, SHUT_WR or SHUT_RDWR
* @param completion_cb the callback that will be called upon successful
* shutdown of given operation
* @param completion_cls the closure for the completion callback
- * @return the shutdown handle
+ * @return the shutdown handle; NULL in case of any error
*/
struct GNUNET_STREAM_ShutdownHandle *
GNUNET_STREAM_shutdown (struct GNUNET_STREAM_Socket *socket,
/**
* Cancels a pending shutdown
*
- * @param the shutdown handle returned from GNUNET_STREAM_shutdown
+ * @param handle the shutdown handle returned from GNUNET_STREAM_shutdown
*/
void
GNUNET_STREAM_shutdown_cancel (struct GNUNET_STREAM_ShutdownHandle *handle);
* @param write_cont the function to call upon writing some bytes into the
* stream
* @param write_cont_cls the closure
- * @return handle to cancel the operation; NULL if a previous write is pending
+ *
+ * @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.
*/
struct GNUNET_STREAM_IOWriteHandle *
GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket,
/**
- * Tries to read data from the stream
+ * Tries to read data from the stream.
*
* @param socket the socket representing a stream
* @param timeout the timeout period
* @param proc function to call with data (once only)
* @param proc_cls the closure for proc
- * @return handle to cancel the operation
+ *
+ * @return handle to cancel the operation; if the stream has been shutdown for
+ * this type of opeartion then the DataProcessor is immediately
+ * called with GNUNET_STREAM_SHUTDOWN as status and NULL if returned
*/
struct GNUNET_STREAM_IOReadHandle *
GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket,