]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Sessions get weak pointers to Connections
authorGreg Farnum <gregory.farnum@dreamhost.com>
Wed, 7 Sep 2011 22:39:53 +0000 (15:39 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Thu, 8 Sep 2011 16:51:10 +0000 (09:51 -0700)
We were previously setting up a reference loop. But the only way
to get Sessions is via the Connection, so let's just give Sessions
the pointer, and give Connections a counted ref.

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/osd/OSD.cc
src/osd/OSD.h

index 954a1ce8673e4a67ef19887ee3e38872cb70006b..90397f428509e35d1629e2b295dbb0c5eb150392 100644 (file)
@@ -2575,7 +2575,7 @@ bool OSD::ms_verify_authorizer(Connection *con, int peer_type,
     if (!s) {
       s = new Session;
       con->set_priv(s->get());
-      s->con = con->get();
+      s->con = con;
       dout(10) << " new session " << s << " con=" << s->con << " addr=" << s->con->get_peer_addr() << dendl;
     }
 
index 29c78a6f2d4ca52063830d945b976add89742460..3b7491414440ec4bfaddb4908d090e890abbd7ba 100644 (file)
@@ -229,7 +229,6 @@ public:
     std::map<void *, entity_name_t> notifs;
 
     Session() : last_sent_epoch(0), con(0) {}
-    ~Session() { if (con) con->put(); }
     void add_notif(void *n, entity_name_t& name) {
       notifs[n] = name;
     }