]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
messenger: a 0 timeout on ::poll really means don't wait
authorGreg Farnum <gregf@hq.newdream.net>
Thu, 21 Oct 2010 20:27:35 +0000 (13:27 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 21 Oct 2010 22:50:10 +0000 (15:50 -0700)
(as opposed to -1, which waits until an event occurs).

So, set the default timeout to -1, and convert ms_tcp_read_timeout
to -1 if it's set at 0.

src/msg/SimpleMessenger.h
src/msg/tcp.h

index 37825948d3c8dd2c7dc3d7c039680939a527b4ad..d450352465cd2138555795a3a58ac485ab52acad 100644 (file)
@@ -216,6 +216,8 @@ private:
       reader_thread(this), writer_thread(this) {
       connection_state->pipe = get();
       messenger->timeout = g_conf.ms_tcp_read_timeout * 1000; //convert to ms
+      if (messenger->timeout == 0)
+        messenger->timeout = -1;
     }
     ~Pipe() {
       for (map<int, xlist<Pipe *>::item* >::iterator i = queue_items.begin();
index 97ef3a90a86dcb6c55285101dcac256d2d036310..89548aa10e9e46750e01f8a156d3de348b1c8b20 100644 (file)
@@ -25,7 +25,7 @@ inline ostream& operator<<(ostream& out, const sockaddr_storage &ss)
             << buf << ':' << serv;
 }
 
-extern int tcp_read(int sd, char *buf, int len, int timeout=0);
+extern int tcp_read(int sd, char *buf, int len, int timeout=-1);
 extern int tcp_write(int sd, const char *buf, int len);
 
 inline bool operator==(const sockaddr_in& a, const sockaddr_in& b) {