Skip to content
Snippets Groups Projects
Commit 3368696b authored by Wang, Ruonan's avatar Wang, Ruonan
Browse files

fixed a few error handling and solved the Windows build error

parent 04a5e5b2
No related branches found
No related tags found
1 merge request!270Finished DataMan Transport Manager refactoring but full functionality still pending on Read API
...@@ -42,9 +42,6 @@ ...@@ -42,9 +42,6 @@
/* CMake Option: ADIOS_USE_ZeroMQ=ON */ /* CMake Option: ADIOS_USE_ZeroMQ=ON */
#cmakedefine ADIOS2_HAVE_ZEROMQ #cmakedefine ADIOS2_HAVE_ZEROMQ
/* CMake Option: ADIOS_USE_DataMan=ON */
#cmakedefine ADIOS2_HAVE_DATAMAN
/* CMake Option: ADIOS_USE_SysVShMem=ON */ /* CMake Option: ADIOS_USE_SysVShMem=ON */
#cmakedefine ADIOS2_HAVE_SYSVSHMEM #cmakedefine ADIOS2_HAVE_SYSVSHMEM
......
...@@ -74,13 +74,11 @@ if(ADIOS2_HAVE_ZeroMQ) ...@@ -74,13 +74,11 @@ if(ADIOS2_HAVE_ZeroMQ)
target_link_libraries(adios2 PRIVATE ZeroMQ::ZMQ) target_link_libraries(adios2 PRIVATE ZeroMQ::ZMQ)
endif() endif()
if(ADIOS2_HAVE_DataMan) target_sources(adios2 PRIVATE
target_sources(adios2 PRIVATE
engine/dataman/DataManReader.cpp engine/dataman/DataManReader.cpp
engine/dataman/DataManWriter.cpp engine/dataman/DataManWriter.cpp
) )
target_link_libraries(adios2 PRIVATE NLohmannJson) target_link_libraries(adios2 PRIVATE NLohmannJson)
endif()
if(ADIOS2_HAVE_BZip2) if(ADIOS2_HAVE_BZip2)
......
...@@ -24,6 +24,10 @@ WANZmq::WANZmq(const std::string ipAddress, const std::string port, ...@@ -24,6 +24,10 @@ WANZmq::WANZmq(const std::string ipAddress, const std::string port,
m_Port(port) m_Port(port)
{ {
m_Context = zmq_ctx_new(); m_Context = zmq_ctx_new();
if (m_Context == nullptr || m_Context == NULL)
{
throw std::runtime_error("ERROR: Creating ZeroMQ context failed");
}
if (m_DebugMode) if (m_DebugMode)
{ {
// TODO verify port is unsigned int // TODO verify port is unsigned int
...@@ -57,6 +61,11 @@ void WANZmq::Open(const std::string &name, const OpenMode openMode) ...@@ -57,6 +61,11 @@ void WANZmq::Open(const std::string &name, const OpenMode openMode)
m_Socket = zmq_socket(m_Context, ZMQ_REQ); m_Socket = zmq_socket(m_Context, ZMQ_REQ);
const std::string fullIP("tcp://" + m_IPAddress + ":" + m_Port); const std::string fullIP("tcp://" + m_IPAddress + ":" + m_Port);
int err = zmq_connect(m_Socket, fullIP.c_str()); int err = zmq_connect(m_Socket, fullIP.c_str());
if (err)
{
throw std::runtime_error("ERROR: zmq_connect() failed with " +
std::to_string(err));
}
if (m_Profiler.IsActive) if (m_Profiler.IsActive)
{ {
...@@ -93,7 +102,7 @@ void WANZmq::Open(const std::string &name, const OpenMode openMode) ...@@ -93,7 +102,7 @@ void WANZmq::Open(const std::string &name, const OpenMode openMode)
if (m_DebugMode) if (m_DebugMode)
{ {
if (m_Socket == NULL) // something goes wrong if (m_Socket == nullptr || m_Socket == NULL) // something goes wrong
{ {
throw std::ios_base::failure( throw std::ios_base::failure(
"ERROR: couldn't open socket for address " + m_Name + "ERROR: couldn't open socket for address " + m_Name +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment