]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/Pipe: document tcp_*()
authorSage Weil <sage@inktank.com>
Sat, 11 Aug 2012 15:03:52 +0000 (08:03 -0700)
committerSage Weil <sage@inktank.com>
Mon, 13 Aug 2012 15:46:14 +0000 (08:46 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
src/msg/Pipe.h

index b7fd4c039bd626d0acabd2e966e0db7bf6de7b5b..d9aeb6ea2c4af4be9f34ed3f01d4ae65b0a997e4 100644 (file)
@@ -238,9 +238,41 @@ class DispatchQueue;
         ::shutdown(sd, SHUT_RDWR);
     }
 
+    /**
+     * do a blocking read of len bytes from socket
+     *
+     * @param buf buffer to read into
+     * @param len exact number of bytes to read
+     * @return negative error code, or the number of bytes (always == len) read.
+     */
     int tcp_read(char *buf, int len);
+
+    /**
+     * wait for bytes to become available on the socket
+     *
+     * @return 0 for success, or -1 on error
+     */
     int tcp_read_wait();
+
+    /**
+     * non-blocking read of available bytes on socket
+     *
+     * This is expected to be used after tcp_read_wait(), and will return
+     * an error if there is no data on the socket to consume.
+     *
+     * @param buf buffer to read into
+     * @param len maximum number of bytes to read
+     * @return bytes read, or -1 on error or when there is no data
+     */
     int tcp_read_nonblocking(char *buf, int len);
+
+    /**
+     * blocking write of bytes to socket
+     *
+     * @param buf buffer
+     * @param len number of bytes to write
+     * @return 0 for success, or -1 on error
+     */
     int tcp_write(const char *buf, int len);
 
   };