aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vpp-api/vom/connection.cpp12
-rw-r--r--src/vpp-api/vom/connection.hpp2
-rw-r--r--src/vpp-api/vom/hw.cpp44
-rw-r--r--src/vpp-api/vom/hw.hpp14
-rw-r--r--src/vpp-api/vom/route.cpp2
-rw-r--r--src/vpp-api/vom/tap_interface.cpp2
6 files changed, 48 insertions, 28 deletions
diff --git a/src/vpp-api/vom/connection.cpp b/src/vpp-api/vom/connection.cpp
index 90c02f943c4..c03ef99c172 100644
--- a/src/vpp-api/vom/connection.cpp
+++ b/src/vpp-api/vom/connection.cpp
@@ -26,7 +26,6 @@ connection::connection()
connection::~connection()
{
- disconnect();
}
void
@@ -35,16 +34,15 @@ connection::disconnect()
m_vapi_conn->disconnect();
}
-void
+int
connection::connect()
{
vapi_error_e rv;
- do {
- rv = m_vapi_conn->connect(m_app_name.c_str(),
- NULL, // m_api_prefix.c_str(),
- 128, 128);
- } while (VAPI_OK != rv);
+ rv = m_vapi_conn->connect(m_app_name.c_str(),
+ NULL, // m_api_prefix.c_str(),
+ 128, 128);
+ return rv;
}
vapi::Connection&
diff --git a/src/vpp-api/vom/connection.hpp b/src/vpp-api/vom/connection.hpp
index c8acf78cca5..06fe840232d 100644
--- a/src/vpp-api/vom/connection.hpp
+++ b/src/vpp-api/vom/connection.hpp
@@ -46,7 +46,7 @@ public:
* Blocking [re]connect call - always eventually succeeds, or the
* universe expires. Not much this system can do without one.
*/
- void connect();
+ int connect();
/**
* Blocking disconnect
diff --git a/src/vpp-api/vom/hw.cpp b/src/vpp-api/vom/hw.cpp
index 91faf9d4db0..8f64a75c092 100644
--- a/src/vpp-api/vom/hw.cpp
+++ b/src/vpp-api/vom/hw.cpp
@@ -27,11 +27,6 @@ HW::cmd_q::cmd_q()
HW::cmd_q::~cmd_q()
{
- m_connected = false;
-
- if (m_rx_thread && m_rx_thread->joinable()) {
- m_rx_thread->join();
- }
}
HW::cmd_q&
@@ -76,12 +71,27 @@ HW::cmd_q::enqueue(std::queue<cmd*>& cmds)
}
}
-void
+bool
HW::cmd_q::connect()
{
- if (m_connected) {
- m_conn.disconnect();
- }
+ int rv;
+
+ if (m_connected)
+ return m_connected;
+
+ rv = m_conn.connect();
+
+ m_connected = true;
+ m_rx_thread.reset(new std::thread(&HW::cmd_q::rx_run, this));
+ return (rv == 0);
+}
+
+void
+HW::cmd_q::disconnect()
+{
+
+ if (!m_connected)
+ return;
m_connected = false;
@@ -89,10 +99,7 @@ HW::cmd_q::connect()
m_rx_thread->join();
}
- m_conn.connect();
-
- m_connected = true;
- m_rx_thread.reset(new std::thread(&HW::cmd_q::rx_run, this));
+ m_conn.disconnect();
}
void
@@ -203,10 +210,16 @@ HW::enqueue(std::queue<cmd*>& cmds)
m_cmdQ->enqueue(cmds);
}
-void
+bool
HW::connect()
{
- m_cmdQ->connect();
+ return m_cmdQ->connect();
+}
+
+void
+HW::disconnect()
+{
+ m_cmdQ->disconnect();
}
void
@@ -236,7 +249,6 @@ HW::poll()
HW::write();
return (m_poll_state);
- return (true);
}
template <>
diff --git a/src/vpp-api/vom/hw.hpp b/src/vpp-api/vom/hw.hpp
index 903aa78fb25..9ba47505619 100644
--- a/src/vpp-api/vom/hw.hpp
+++ b/src/vpp-api/vom/hw.hpp
@@ -222,7 +222,12 @@ public:
/**
* Blocking Connect to VPP - call once at bootup
*/
- virtual void connect();
+ virtual bool connect();
+
+ /**
+ * Disconnect to VPP
+ */
+ virtual void disconnect();
/**
* Disable the passing of commands to VPP. Whilst disabled all
@@ -309,7 +314,12 @@ public:
/**
* Blocking Connect to VPP
*/
- static void connect();
+ static bool connect();
+
+ /**
+ * Disconnect to VPP
+ */
+ static void disconnect();
/**
* Blocking pool of the HW connection
diff --git a/src/vpp-api/vom/route.cpp b/src/vpp-api/vom/route.cpp
index 78ea8cebfad..a0474676ee6 100644
--- a/src/vpp-api/vom/route.cpp
+++ b/src/vpp-api/vom/route.cpp
@@ -486,7 +486,7 @@ ip_route::event_handler::handle_populate(const client_db::key_t& key)
dependency_t
ip_route::event_handler::order() const
{
- return (dependency_t::BINDING);
+ return (dependency_t::ENTRY);
}
void
diff --git a/src/vpp-api/vom/tap_interface.cpp b/src/vpp-api/vom/tap_interface.cpp
index 1f85ca11507..d7f16f5c132 100644
--- a/src/vpp-api/vom/tap_interface.cpp
+++ b/src/vpp-api/vom/tap_interface.cpp
@@ -125,7 +125,7 @@ tap_interface::event_handler::event_handler()
void
tap_interface::event_handler::handle_replay()
{
- m_db.replay();
+ // It will be replayed by interface handler
}
dependency_t