]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/Connection: add failed flag for lossy Connections
authorSage Weil <sage@inktank.com>
Thu, 19 Jul 2012 16:27:05 +0000 (09:27 -0700)
committerSage Weil <sage@inktank.com>
Sat, 21 Jul 2012 01:36:32 +0000 (18:36 -0700)
If a lossy Connection fails and we disconnect the Pipe, set a failed flag.

Signed-off-by: Sage Weil <sage@inktank.com>
src/msg/Message.h

index 52708bad5b6f4d074119e4db07818cf1e127a95c..737e71e773913d48cb3f9ff73c342e86f206e0d6 100644 (file)
@@ -151,13 +151,21 @@ struct Connection : public RefCountedObject {
   entity_addr_t peer_addr;
   unsigned features;
   RefCountedObject *pipe;
+  bool failed;              /// true if we are a lossy connection that has failed.
 
   int rx_buffers_version;
   map<tid_t,pair<bufferlist,int> > rx_buffers;
 
 public:
-  Connection() : lock("Connection::lock"), priv(NULL), peer_type(-1), features(0), pipe(NULL),
-                rx_buffers_version(0) {}
+  Connection()
+    : lock("Connection::lock"),
+      priv(NULL),
+      peer_type(-1),
+      features(0),
+      pipe(NULL),
+      failed(false),
+      rx_buffers_version(0) {
+  }
   ~Connection() {
     //generic_dout(0) << "~Connection " << this << dendl;
     if (priv) {
@@ -192,10 +200,11 @@ public:
     return NULL;
   }
   void clear_pipe(RefCountedObject *old_p) {
-    if(old_p == pipe) {
+    if (old_p == pipe) {
       Mutex::Locker l(lock);
       pipe->put();
       pipe = NULL;
+      failed = true;
     }
   }
   void reset_pipe(RefCountedObject *p) {