This is an automated email from the ASF dual-hosted git repository.

isapego pushed a commit to branch ignite-17424
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit 5ab37fa54ca9c40f49bced217f2e635b60e80ed9
Author: Igor Sapego <isap...@apache.org>
AuthorDate: Wed Sep 7 23:57:57 2022 +0400

    IGNITE-17424 Links on Windows
---
 modules/platforms/cpp/client-test/CMakeLists.txt   |  6 +++---
 .../cpp/client/src/cluster_connection.cpp          |  1 +
 modules/platforms/cpp/common/ignite_error.h        |  8 ++++++++
 modules/platforms/cpp/conanfile.txt                |  4 ++--
 modules/platforms/cpp/network/CMakeLists.txt       |  4 +---
 .../src/network/linux_async_worker_thread.cpp      | 14 +++++++-------
 .../cpp/network/os/win/src/network/sockets.cpp     |  6 ++++--
 .../cpp/network/os/win/src/network/utils.cpp       |  6 ++++--
 .../os/win/src/network/win_async_client_pool.cpp   |  8 +++++---
 .../src/network/win_async_connecting_thread.cpp    | 14 ++++++++------
 .../os/win/src/network/win_async_worker_thread.cpp |  4 +++-
 modules/platforms/cpp/network/src/network/utils.h  | 22 +++++++++++-----------
 modules/platforms/cpp/protocol/CMakeLists.txt      |  4 +++-
 13 files changed, 60 insertions(+), 41 deletions(-)

diff --git a/modules/platforms/cpp/client-test/CMakeLists.txt 
b/modules/platforms/cpp/client-test/CMakeLists.txt
index 34202f707e..aae4c83c7e 100644
--- a/modules/platforms/cpp/client-test/CMakeLists.txt
+++ b/modules/platforms/cpp/client-test/CMakeLists.txt
@@ -19,11 +19,11 @@ project(ignite-client-test)
 
 set(TARGET ${PROJECT_NAME})
 
-include_directories(include src)
+find_package(GTest REQUIRED)
+
+include_directories(include src ${GTEST_INCLUDE_DIR})
 
 enable_testing()
-find_package(GTest REQUIRED)
-include_directories(${GTEST_INCLUDE_DIR})
 
 set(SOURCES
        src/ignite_client_test.cpp
diff --git a/modules/platforms/cpp/client/src/cluster_connection.cpp 
b/modules/platforms/cpp/client/src/cluster_connection.cpp
index fa9f10f8a0..288f005179 100644
--- a/modules/platforms/cpp/client/src/cluster_connection.cpp
+++ b/modules/platforms/cpp/client/src/cluster_connection.cpp
@@ -230,6 +230,7 @@ void ClusterConnection::handshake(uint64_t id, 
ProtocolContext& context)
     }
     catch (const IgniteError& err)
     {
+        m_logger->logWarning("Failed to send handshake request: " + 
err.whatStr());
         handshakeFail(id, std::nullopt);
     }
 }
diff --git a/modules/platforms/cpp/common/ignite_error.h 
b/modules/platforms/cpp/common/ignite_error.h
index b2224e2903..42d2553870 100644
--- a/modules/platforms/cpp/common/ignite_error.h
+++ b/modules/platforms/cpp/common/ignite_error.h
@@ -81,6 +81,14 @@ public:
     {
         return m_message.c_str();
     }
+    /**
+     * Get error message as std::string.
+     */
+    [[nodiscard]]
+    const std::string& whatStr() const
+    {
+        return m_message;
+    }
 
     /**
      * Get status code.
diff --git a/modules/platforms/cpp/conanfile.txt 
b/modules/platforms/cpp/conanfile.txt
index cf328d1504..d8ef2acd2a 100644
--- a/modules/platforms/cpp/conanfile.txt
+++ b/modules/platforms/cpp/conanfile.txt
@@ -1,7 +1,7 @@
 [requires]
-openssl/1.1.1q
 msgpack-c/4.0.0
 gtest/1.12.1
 
 [generators]
-cmake
\ No newline at end of file
+CMakeDeps
+CMakeToolchain
\ No newline at end of file
diff --git a/modules/platforms/cpp/network/CMakeLists.txt 
b/modules/platforms/cpp/network/CMakeLists.txt
index 3c8ad4a1ca..13b329b099 100644
--- a/modules/platforms/cpp/network/CMakeLists.txt
+++ b/modules/platforms/cpp/network/CMakeLists.txt
@@ -19,9 +19,7 @@ project(ignite-network)
 
 set(TARGET ${PROJECT_NAME})
 
-find_package(OpenSSL REQUIRED)
-
-include_directories(include src ${OPENSSL_INCLUDE_DIR})
+include_directories(include src)
 
 set(SOURCES
     src/network/async_client_pool_adapter.cpp
diff --git 
a/modules/platforms/cpp/network/os/linux/src/network/linux_async_worker_thread.cpp
 
b/modules/platforms/cpp/network/os/linux/src/network/linux_async_worker_thread.cpp
index 092ba0e788..34d6e84f3a 100644
--- 
a/modules/platforms/cpp/network/os/linux/src/network/linux_async_worker_thread.cpp
+++ 
b/modules/platforms/cpp/network/os/linux/src/network/linux_async_worker_thread.cpp
@@ -64,14 +64,14 @@ namespace ignite
         {
             epoll = epoll_create(1);
             if (epoll < 0)
-                common::ThrowLastSystemError("Failed to create epoll 
instance");
+                common::throwLastSystemError("Failed to create epoll 
instance");
 
             stopEvent = eventfd(0, EFD_NONBLOCK);
             if (stopEvent < 0)
             {
-                std::string msg = common::GetLastSystemError("Failed to create 
stop event instance");
+                std::string msg = common::getLastSystemError("Failed to create 
stop event instance");
                 close(stopEvent);
-                common::ThrowSystemError(msg);
+                common::throwSystemError(msg);
             }
 
             epoll_event event;
@@ -82,10 +82,10 @@ namespace ignite
             int res = epoll_ctl(epoll, EPOLL_CTL_ADD, stopEvent, &event);
             if (res < 0)
             {
-                std::string msg = common::GetLastSystemError("Failed to create 
stop event instance");
+                std::string msg = common::getLastSystemError("Failed to create 
stop event instance");
                 close(stopEvent);
                 close(epoll);
-                common::ThrowSystemError(msg);
+                common::throwSystemError(msg);
             }
 
             m_stopping = false;
@@ -190,7 +190,7 @@ namespace ignite
             currentClient = currentConnection->ToClient(socketFd);
             bool ok = currentClient->StartMonitoring(epoll);
             if (!ok)
-                common::ThrowLastSystemError("Can not add file descriptor to 
epoll");
+                common::throwLastSystemError("Can not add file descriptor to 
epoll");
 
             // Connect to server.
             int res = connect(socketFd, addr->ai_addr, addr->ai_addrlen);
@@ -325,7 +325,7 @@ namespace ignite
             if (lastConnectionTime.tv_sec == 0)
                 return 0;
 
-            int timeout = fibonacci10.GetValue(m_failedAttempts) * 1000;
+            int timeout = fibonacci10.getValue(m_failedAttempts) * 1000;
 
             timespec now;
             clock_gettime(CLOCK_MONOTONIC, &now);
diff --git a/modules/platforms/cpp/network/os/win/src/network/sockets.cpp 
b/modules/platforms/cpp/network/os/win/src/network/sockets.cpp
index 2565a2b77f..3803167d9f 100644
--- a/modules/platforms/cpp/network/os/win/src/network/sockets.cpp
+++ b/modules/platforms/cpp/network/os/win/src/network/sockets.cpp
@@ -23,7 +23,9 @@
 #include "network/utils.h"
 
 // Using NULLs as specified by WinAPI
-#pragma ide diagnostic ignored "modernize-use-nullptr"
+#ifdef __JETBRAINS_IDE__
+#   pragma ide diagnostic ignored "modernize-use-nullptr"
+#endif
 
 namespace ignite::network
 {
@@ -156,7 +158,7 @@ void InitWsa()
             networkInited = WSAStartup(MAKEWORD(2, 2), &wsaData) == 0;
 
             if (!networkInited)
-                ThrowNetworkError("Networking initialisation failed: " + 
getLastSocketErrorMessage());
+                throwNetworkError("Networking initialisation failed: " + 
getLastSocketErrorMessage());
         }
     }
 }
diff --git a/modules/platforms/cpp/network/os/win/src/network/utils.cpp 
b/modules/platforms/cpp/network/os/win/src/network/utils.cpp
index c941dd1e84..15f1ed982f 100644
--- a/modules/platforms/cpp/network/os/win/src/network/utils.cpp
+++ b/modules/platforms/cpp/network/os/win/src/network/utils.cpp
@@ -20,12 +20,14 @@
 #include "network/utils.h"
 
 // Using NULLs as specified by WinAPI
-#pragma ide diagnostic ignored "modernize-use-nullptr"
+#ifdef __JETBRAINS_IDE__
+#   pragma ide diagnostic ignored "modernize-use-nullptr"
+#endif
 
 namespace ignite::network
 {
 
-std::string GetLastSystemError()
+std::string getLastSystemError()
 {
     DWORD errorCode = GetLastError();
 
diff --git 
a/modules/platforms/cpp/network/os/win/src/network/win_async_client_pool.cpp 
b/modules/platforms/cpp/network/os/win/src/network/win_async_client_pool.cpp
index a993613c4c..86db983836 100644
--- a/modules/platforms/cpp/network/os/win/src/network/win_async_client_pool.cpp
+++ b/modules/platforms/cpp/network/os/win/src/network/win_async_client_pool.cpp
@@ -23,7 +23,9 @@
 #include "network/win_async_client_pool.h"
 
 // Using NULLs as specified by WinAPI
-#pragma ide diagnostic ignored "modernize-use-nullptr"
+#ifdef __JETBRAINS_IDE__
+#   pragma ide diagnostic ignored "modernize-use-nullptr"
+#endif
 
 namespace ignite::network
 {
@@ -54,7 +56,7 @@ void WinAsyncClientPool::start(std::vector<TcpRange> addrs, 
uint32_t connLimit)
 
     m_iocp = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
     if (!m_iocp)
-        ThrowLastSystemError("Failed to create IOCP instance");
+        throwLastSystemError("Failed to create IOCP instance");
 
     try
     {
@@ -113,7 +115,7 @@ bool 
WinAsyncClientPool::addClient(std::shared_ptr<WinAsyncClient> client)
 
         HANDLE iocp0 = client->addToIocp(m_iocp);
         if (iocp0 == NULL)
-            ThrowLastSystemError("Can not add socket to IOCP");
+            throwLastSystemError("Can not add socket to IOCP");
 
         m_iocp = iocp0;
 
diff --git 
a/modules/platforms/cpp/network/os/win/src/network/win_async_connecting_thread.cpp
 
b/modules/platforms/cpp/network/os/win/src/network/win_async_connecting_thread.cpp
index d5bfec7de1..cc678e6237 100644
--- 
a/modules/platforms/cpp/network/os/win/src/network/win_async_connecting_thread.cpp
+++ 
b/modules/platforms/cpp/network/os/win/src/network/win_async_connecting_thread.cpp
@@ -22,7 +22,9 @@
 #include "network/win_async_connecting_thread.h"
 
 // Using NULLs as specified by WinAPI
-#pragma ide diagnostic ignored "modernize-use-nullptr"
+#ifdef __JETBRAINS_IDE__
+#   pragma ide diagnostic ignored "modernize-use-nullptr"
+#endif
 
 namespace
 {
@@ -59,7 +61,7 @@ void WinAsyncConnectingThread::run()
         {
             ++m_failedAttempts;
 
-            auto msToWait = static_cast<DWORD>(1000 * 
fibonacci10.GetValue(m_failedAttempts));
+            auto msToWait = static_cast<DWORD>(1000 * 
fibonacci10.getValue(m_failedAttempts));
             if (msToWait)
                 Sleep(msToWait);
 
@@ -150,7 +152,7 @@ std::shared_ptr<WinAsyncClient> 
WinAsyncConnectingThread::tryConnect(const TcpRa
         {
             SOCKET socket = tryConnect(addr);
 
-            return std::make_shared<WinAsyncClient>(socket, addr, range, 
BUFFER_SIZE);
+            return std::make_shared<WinAsyncClient>(socket, addr, range, 
int32_t(BUFFER_SIZE));
         }
         catch (const IgniteError&)
         {
@@ -179,7 +181,7 @@ SOCKET WinAsyncConnectingThread::tryConnect(const EndPoint& 
addr)
     int res = getaddrinfo(addr.host.c_str(), strPort.c_str(), &hints, &result);
 
     if (res != 0)
-        ThrowNetworkError("Can not resolve host: " + addr.host + ":" + 
strPort);
+        throwNetworkError("Can not resolve host: " + addr.host + ":" + 
strPort);
 
     std::string lastErrorMsg = "Failed to resolve host";
 
@@ -193,7 +195,7 @@ SOCKET WinAsyncConnectingThread::tryConnect(const EndPoint& 
addr)
         socket = WSASocket(it->ai_family, it->ai_socktype, it->ai_protocol, 
NULL, 0, WSA_FLAG_OVERLAPPED);
 
         if (socket == INVALID_SOCKET)
-            ThrowNetworkError("Socket creation failed: " + 
getLastSocketErrorMessage());
+            throwNetworkError("Socket creation failed: " + 
getLastSocketErrorMessage());
 
         TrySetSocketOptions(socket, BUFFER_SIZE, TRUE, TRUE, TRUE);
 
@@ -220,7 +222,7 @@ SOCKET WinAsyncConnectingThread::tryConnect(const EndPoint& 
addr)
     freeaddrinfo(result);
 
     if (socket == INVALID_SOCKET)
-        ThrowNetworkError(lastErrorMsg);
+        throwNetworkError(lastErrorMsg);
 
     return socket;
 }
diff --git 
a/modules/platforms/cpp/network/os/win/src/network/win_async_worker_thread.cpp 
b/modules/platforms/cpp/network/os/win/src/network/win_async_worker_thread.cpp
index 8cfda7a45c..a30eb35de9 100644
--- 
a/modules/platforms/cpp/network/os/win/src/network/win_async_worker_thread.cpp
+++ 
b/modules/platforms/cpp/network/os/win/src/network/win_async_worker_thread.cpp
@@ -23,7 +23,9 @@
 #include "network/win_async_worker_thread.h"
 
 // Using NULLs as specified by WinAPI
-#pragma ide diagnostic ignored "modernize-use-nullptr"
+#ifdef __JETBRAINS_IDE__
+#   pragma ide diagnostic ignored "modernize-use-nullptr"
+#endif
 
 namespace ignite::network
 {
diff --git a/modules/platforms/cpp/network/src/network/utils.h 
b/modules/platforms/cpp/network/src/network/utils.h
index 959299f7c3..b87f576dfe 100644
--- a/modules/platforms/cpp/network/src/network/utils.h
+++ b/modules/platforms/cpp/network/src/network/utils.h
@@ -56,7 +56,7 @@ public:
      * @return N-th member of sequence if n < size, or max member.
      */
     [[nodiscard]]
-    constexpr T GetValue(size_t n) const
+    constexpr T getValue(size_t n) const
     {
         return n < size ? sequence[n] : sequence[size-1];
     }
@@ -71,7 +71,7 @@ private:
  *
  * @param err Error message.
  */
-inline void ThrowNetworkError(std::string err)
+inline void throwNetworkError(std::string err)
 {
     // TODO: Remove me
     throw IgniteError(StatusCode::NETWORK, std::move(err));
@@ -84,7 +84,7 @@ inline void ThrowNetworkError(std::string err)
  * @param description Error details.
  * @param advice User advice.
  */
-std::string FormatErrorMessage(std::string_view description, std::string_view 
details, std::string_view advice)
+inline std::string formatErrorMessage(std::string_view description, 
std::string_view details, std::string_view advice)
 {
     std::stringstream messageBuilder;
     messageBuilder << description;
@@ -102,7 +102,7 @@ std::string FormatErrorMessage(std::string_view 
description, std::string_view de
  *
  * @return Error in human-readable format.
  */
-std::string GetLastSystemError();
+std::string getLastSystemError();
 
 /**
  * Try extract from system error stack, format and return platform-specific 
error.
@@ -110,9 +110,9 @@ std::string GetLastSystemError();
  * @param description Error description.
  * @return Error in human-readable format.
  */
-std::string GetLastSystemError(std::string_view description, std::string_view 
advice)
+inline std::string getLastSystemError(std::string_view description, 
std::string_view advice)
 {
-    return FormatErrorMessage(description, GetLastSystemError(), advice);
+    return formatErrorMessage(description, getLastSystemError(), advice);
 }
 
 /**
@@ -120,7 +120,7 @@ std::string GetLastSystemError(std::string_view 
description, std::string_view ad
  *
  * @param msg Error message.
  */
-inline void ThrowSystemError(std::string msg)
+inline void throwSystemError(std::string msg)
 {
     // TODO: Remove me
     throw IgniteError(StatusCode::OS, std::move(msg));
@@ -132,9 +132,9 @@ inline void ThrowSystemError(std::string msg)
  * @param description Error description.
  * @param advice User advice.
  */
-void ThrowLastSystemError(std::string_view description, std::string_view 
advice)
+inline void throwLastSystemError(std::string_view description, 
std::string_view advice)
 {
-    ThrowSystemError(GetLastSystemError(description, advice));
+    throwSystemError(getLastSystemError(description, advice));
 }
 
 /**
@@ -142,9 +142,9 @@ void ThrowLastSystemError(std::string_view description, 
std::string_view advice)
  *
  * @param description Error description.
  */
-void ThrowLastSystemError(std::string_view description)
+inline void throwLastSystemError(std::string_view description)
 {
-    ThrowLastSystemError(description, "");
+    throwLastSystemError(description, "");
 }
 
 } // namespace ignite::network
diff --git a/modules/platforms/cpp/protocol/CMakeLists.txt 
b/modules/platforms/cpp/protocol/CMakeLists.txt
index 8ff9e3ce22..08fb9c22b1 100644
--- a/modules/platforms/cpp/protocol/CMakeLists.txt
+++ b/modules/platforms/cpp/protocol/CMakeLists.txt
@@ -19,6 +19,8 @@ project(ignite-protocol)
 
 set(TARGET ${PROJECT_NAME})
 
+find_package(msgpack)
+
 include_directories(include)
 
 set(SOURCES
@@ -32,5 +34,5 @@ add_library(${TARGET} OBJECT ${SOURCES})
 set_target_properties(${TARGET} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION})
 set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE 1)
 
-target_link_libraries(${TARGET} ignite-common)
+target_link_libraries(${TARGET} ignite-common msgpackc)
 target_include_directories(${TARGET} INTERFACE include)

Reply via email to