]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/simple: fix wrong condition checking of writing TAG_CLOSE on closing 10343/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 19 Jul 2016 07:29:29 +0000 (15:29 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 19 Jul 2016 07:29:29 +0000 (15:29 +0800)
The sd is initialized to -1 and will be resetted to -1 whenever it is
invalidated. So "if (sd)" is not reasonable enough to determine whether
or not the sd is currently still in use.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/msg/simple/Pipe.cc

index 2c2efb097f7b591b73583df853a5bff76392b7c1..835868a3685161c78ad6931c79c1bed4d63ebf14 100644 (file)
@@ -887,7 +887,7 @@ int Pipe::connect()
   __u32 cseq = connect_seq;
   __u32 gseq = msgr->get_global_seq();
 
-  // stop reader thrad
+  // stop reader thread
   join_reader();
 
   pipe_lock.Unlock();
@@ -1736,7 +1736,7 @@ void Pipe::writer()
       state = STATE_CLOSED;
       state_closed.set(1);
       pipe_lock.Unlock();
-      if (sd) {
+      if (sd >= 0) {
        // we can ignore return value, actually; we don't care if this succeeds.
        int r = ::write(sd, &tag, 1);
        (void)r;