]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async: guard protocol Interceptor with preprocessor variable 26541/head
authorRicardo Dias <rdias@suse.com>
Thu, 21 Feb 2019 16:01:22 +0000 (16:01 +0000)
committerRicardo Dias <rdias@suse.com>
Thu, 21 Feb 2019 16:01:22 +0000 (16:01 +0000)
Signed-off-by: Ricardo Dias <rdias@suse.com>
src/msg/Connection.h
src/msg/Messenger.h
src/msg/async/AsyncConnection.cc
src/msg/async/ProtocolV2.cc

index 7c8d6dc15fa836ba7619bf60f7bc988b30e63692..20148749c8c2004b23aa027bbaff9e2d43f629bb 100644 (file)
 // abstract Connection, for keeping per-connection state
 
 class Messenger;
+
+#ifdef UNIT_TESTS_BUILT
 class Interceptor;
+#endif
 
 struct Connection : public RefCountedObject {
   mutable Mutex lock;
@@ -62,7 +65,9 @@ public:
   EntityName peer_name;
   uint64_t peer_global_id = 0;
 
+#ifdef UNIT_TESTS_BUILT
   Interceptor *interceptor;
+#endif
 
   friend class boost::intrusive_ptr<Connection>;
   friend class PipeConnection;
index 432efb5fd7336c4cd05ca60d742acaace2d8c6d9..2602765cf4457813dbeb6d30abf103c88c11aeaa 100644 (file)
@@ -49,6 +49,8 @@ class Timer;
 class AuthClient;
 class AuthServer;
 
+#ifdef UNIT_TESTS_BUILT
+
 struct Interceptor {
   std::mutex lock;
   std::condition_variable cond_var;
@@ -63,6 +65,8 @@ struct Interceptor {
   virtual ACTION intercept(Connection *conn, uint32_t step) = 0;
 };
 
+#endif
+
 class Messenger {
 private:
   std::deque<Dispatcher*> dispatchers;
@@ -89,7 +93,10 @@ protected:
 public:
   AuthClient *auth_client = 0;
   AuthServer *auth_server = 0;
+
+#ifdef UNIT_TESTS_BUILT
   Interceptor *interceptor = nullptr;
+#endif
 
   /**
    * Various Messenger conditional config/type flags to allow
index 6e4991b4058db1519df595df3f6943aece1deca2..18a9c00c4d15c69d7e8bae506f10ff40d7c37612 100644 (file)
@@ -123,7 +123,9 @@ AsyncConnection::AsyncConnection(CephContext *cct, AsyncMessenger *m, DispatchQu
     msgr2(m2), state_offset(0),
     worker(w), center(&w->center),read_buffer(nullptr)
 {
+#ifdef UNIT_TESTS_BUILT
   this->interceptor = m->interceptor;
+#endif
   read_handler = new C_handle_read(this);
   write_handler = new C_handle_write(this);
   write_callback_handler = new C_handle_write_callback(this);
index c523e3635aeaad8c31bef23bec925d48c8818b78..062d53bf910d4c6931cdc76cbd2745f1e706efae 100644 (file)
@@ -96,6 +96,8 @@ const int SIGNATURE_BLOCK_SIZE = CEPH_CRYPTO_HMACSHA256_DIGESTSIZE;
 
 #define READB(L, B, C) read(CONTINUATION(C), L, B)
 
+#ifdef UNIT_TESTS_BUILT
+
 #define INTERCEPT(S) { \
 if(connection->interceptor) { \
   auto a = connection->interceptor->intercept(connection, (S)); \
@@ -106,6 +108,10 @@ if(connection->interceptor) { \
     connection->dispatch_queue->queue_reset(connection); \
     return nullptr; \
   }}}
+  
+#else
+#define INTERCEPT(S)
+#endif
 
 static void alloc_aligned_buffer(bufferlist &data, unsigned len, unsigned off) {
   // create a buffer to read into that matches the data alignment