]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/msg/xio/XioConnection.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / msg / xio / XioConnection.h
index 1ed88b995d8e867aa010febfc32cbf89937b2ad6..00024ef3177b688efdc52424af8d6de405356e89 100644 (file)
@@ -72,7 +72,7 @@ private:
   entity_inst_t peer;
   struct xio_session *session;
   struct xio_connection        *conn;
-  pthread_spinlock_t sp;
+  ceph::util::spinlock sp;
   std::atomic<int64_t> send = { 0 };
   std::atomic<int64_t> recv = { 0 };
   uint32_t n_reqs; // Accelio-initiated reqs in progress (!counting partials)
@@ -132,7 +132,7 @@ private:
     Messenger::Policy policy;
 
     CryptoKey session_key;
-    ceph::shared_ptr<AuthSessionHandler> session_security;
+    std::shared_ptr<AuthSessionHandler> session_security;
     AuthAuthorizer *authorizer;
     XioConnection *xcon;
     uint32_t protocol_version;
@@ -241,19 +241,24 @@ private:
   friend class XioSend;
 
   int on_disconnect_event() {
+    std::lock_guard<ceph::spinlock> lg(sp);
+
     connected = false;
-    pthread_spin_lock(&sp);
     discard_out_queues(CState::OP_FLAG_LOCKED);
-    pthread_spin_unlock(&sp);
+
     return 0;
   }
 
   int on_teardown_event() {
-    pthread_spin_lock(&sp);
+
+    {
+    std::lock_guard<ceph::spinlock> lg(sp);
+
     if (conn)
       xio_connection_destroy(conn);
     conn = NULL;
-    pthread_spin_unlock(&sp);
+    }
+
     this->put();
     return 0;
   }