Skip to content

Commit dd8aabf

Browse files
committed
Remove old network implementation
* remove network and tests from source tree * adapt code style * cleanup cmake Relates-to: OLPEDGE-585 Signed-off-by: Serhii Lysenko <[email protected]>
1 parent e8b4f94 commit dd8aabf

File tree

76 files changed

+27
-13924
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+27
-13924
lines changed

olp-cpp-sdk-authentication/src/BaseResult.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <rapidjson/document.h>
2323

2424
#include "Constants.h"
25-
2625
#include "olp/core/http/HttpStatusCode.h"
2726

2827
using namespace rapidjson;

olp-cpp-sdk-authentication/test/unit/AuthenticationProductionTests.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <olp/authentication/AuthenticationClient.h>
2222
#include <olp/core/client/OlpClientSettingsFactory.h>
2323
#include <olp/core/http/HttpStatusCode.h>
24-
#include <olp/core/network/Network.h>
2524
#include <olp/core/porting/make_unique.h>
2625
#include <future>
2726
#include <memory>
@@ -71,6 +70,9 @@ class AuthenticationOnlineProductionTest : public ::testing::Test {
7170
static std::shared_ptr<olp::http::Network> s_network_;
7271
};
7372

73+
// Static network instance is necessary as it needs to outlive any created
74+
// clients. This is a known limitation as triggered send requests capture the
75+
// network instance inside the callbacks.
7476
std::shared_ptr<olp::http::Network> AuthenticationOnlineProductionTest::s_network_;
7577

7678
TEST_F(AuthenticationOnlineProductionTest, SignInClient) {

olp-cpp-sdk-core/CMakeLists.txt

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,10 @@ file(GLOB GENERATED_HEADERS
7070
"${CMAKE_CURRENT_SOURCE_DIR}/include/olp/core/generated/serializer/*.h"
7171
)
7272

73-
file(GLOB NETWORK_HEADERS
74-
"${CMAKE_CURRENT_SOURCE_DIR}/include/olp/core/network/*.h"
75-
)
7673
set(EDGE_SDK_HTTP_HEADERS
7774
"${CMAKE_CURRENT_SOURCE_DIR}/include/olp/core/http/HttpStatusCode.h"
7875
"${CMAKE_CURRENT_SOURCE_DIR}/include/olp/core/http/Network.h"
76+
"${CMAKE_CURRENT_SOURCE_DIR}/include/olp/core/http/HttpStatusCode.h"
7977
"${CMAKE_CURRENT_SOURCE_DIR}/include/olp/core/http/NetworkConstants.h"
8078
"${CMAKE_CURRENT_SOURCE_DIR}/include/olp/core/http/NetworkProxySettings.h"
8179
"${CMAKE_CURRENT_SOURCE_DIR}/include/olp/core/http/NetworkRequest.h"
@@ -137,11 +135,6 @@ file(GLOB GENERATED_SOURCE
137135
"${CMAKE_CURRENT_SOURCE_DIR}/src/generated/serializer/*.cpp"
138136
)
139137

140-
file(GLOB NETWORK_SOURCE
141-
"${CMAKE_CURRENT_SOURCE_DIR}/src/network/*.cpp"
142-
"${CMAKE_CURRENT_SOURCE_DIR}/src/network/*.h"
143-
)
144-
145138
set(EDGE_SDK_HTTP_SOURCES
146139
"${CMAKE_CURRENT_SOURCE_DIR}/src/http/Network.cpp"
147140
"${CMAKE_CURRENT_SOURCE_DIR}/src/http/NetworkProxySettings.cpp"
@@ -152,12 +145,6 @@ set(EDGE_SDK_HTTP_SOURCES
152145
)
153146

154147
if (ANDROID)
155-
file(GLOB NETWORK_ANDROID_SOURCE
156-
"${CMAKE_CURRENT_SOURCE_DIR}/src/network/android/*.cpp"
157-
"${CMAKE_CURRENT_SOURCE_DIR}/src/network/android/*.h"
158-
"${CMAKE_CURRENT_SOURCE_DIR}/src/network/socket/*.cpp"
159-
)
160-
set(NETWORK_SOURCE ${NETWORK_SOURCE} ${NETWORK_ANDROID_SOURCE})
161148

162149
# http network Android implementation:
163150
set(EDGE_SDK_HTTP_ANDROID_SOURCES
@@ -171,19 +158,16 @@ if (ANDROID)
171158
set(EDGE_SDK_DEFAULT_NETWORK_DEFINITION NETWORK_HAS_ANDROID)
172159
endif()
173160
if (UNIX AND NOT ANDROID)
174-
set(NETWORK_SOURCE ${NETWORK_SOURCE} ${NETWORK_CURL_SOURCES})
175161
set(EDGE_SDK_HTTP_SOURCES ${EDGE_SDK_HTTP_SOURCES} ${EDGE_SDK_HTTP_CURL_SOURCES})
176162

177163
set(EDGE_SDK_DEFAULT_NETWORK_DEFINITION NETWORK_HAS_CURL)
178164
endif()
179165
if (IOS)
180-
set(NETWORK_SOURCE ${NETWORK_SOURCE} ${NETWORK_IOS_SOURCES})
181166
set(EDGE_SDK_HTTP_SOURCES ${EDGE_SDK_HTTP_SOURCES} ${EDGE_SDK_HTTP_IOS_SOURCES})
182167

183168
set(EDGE_SDK_DEFAULT_NETWORK_DEFINITION NETWORK_HAS_IOS)
184169
endif()
185170
if (WIN32)
186-
set(NETWORK_SOURCE ${NETWORK_SOURCE} ${NETWORK_WINHTTP_SOURCES})
187171
set(EDGE_SDK_HTTP_SOURCES ${EDGE_SDK_HTTP_SOURCES} ${EDGE_SDK_HTTP_WIN_SOURCES})
188172

189173
set(EDGE_SDK_DEFAULT_NETWORK_DEFINITION NETWORK_HAS_WINHTTP)
@@ -211,7 +195,6 @@ file(GLOB CORE_HEADERS
211195
${CACHE_HEADERS}
212196
${CLIENT_HEADERS}
213197
${GENERATED_HEADERS}
214-
${NETWORK_HEADERS}
215198
${EDGE_SDK_HTTP_HEADERS}
216199
${PLATFORM_HEADERS}
217200
${PORTING_HEADERS}
@@ -230,7 +213,6 @@ file(GLOB CORE_SOURCE
230213
${CACHE_SOURCE}
231214
${CLIENT_SOURCE}
232215
${GENERATED_SOURCE}
233-
${NETWORK_SOURCE}
234216
${EDGE_SDK_HTTP_SOURCES}
235217
${PLATFORM_SOURCE}
236218
${PORTING_SOURCE}
@@ -325,7 +307,6 @@ if(BUILD_SHARED_LIBS)
325307
endif()
326308

327309
# install component
328-
install (FILES ${NETWORK_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/olp/core/network)
329310
install (FILES ${EDGE_SDK_HTTP_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/olp/core/http)
330311
install (FILES ${PLATFORM_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/olp/core/platform)
331312
install (FILES ${PORTING_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/olp/core/porting)
@@ -349,6 +330,5 @@ if(EDGE_SDK_ENABLE_TESTING)
349330
add_subdirectory(tests/client)
350331
add_subdirectory(tests/olpclient)
351332
add_subdirectory(tests/geo)
352-
add_subdirectory(tests/network)
353333
add_subdirectory(tests/thread)
354334
endif()

olp-cpp-sdk-core/include/olp/core/client/OlpClient.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@ class NetworkConfig;
3737
} // namespace network
3838

3939
namespace client {
40-
/**
41-
* @brief Async network handler that delegates to the core network component.
42-
*/
43-
CancellationToken DefaultNetworkAsyncHandler(
44-
const network::NetworkRequest& request,
45-
const network::NetworkConfig& config, const NetworkAsyncCallback& callback);
46-
4740
/**
4841
* @brief This class is responsible for executing the REST requests.
4942
*/

olp-cpp-sdk-core/include/olp/core/client/OlpClientSettings.h

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
#include <boost/optional.hpp>
2727

2828
#include "olp/core/client/CancellationToken.h"
29+
#include "olp/core/client/HttpResponse.h"
2930
#include "olp/core/http/Network.h"
3031
#include "olp/core/client/HttpResponse.h"
31-
#include "olp/core/network/NetworkProxy.h"
3232

3333
namespace olp {
3434

@@ -43,21 +43,13 @@ class TaskScheduler;
4343

4444
namespace http {
4545
class Network;
46-
struct HttpResponse;
4746
} // namespace http
4847

4948
namespace client {
5049

5150
using NetworkAsyncCallback = std::function<void(HttpResponse)>;
5251
using NetworkAsyncCancel = std::function<void()>;
5352

54-
/**
55-
* @brief Handler for asynchronous execution of network requests.
56-
*/
57-
using NetworkAsyncHandler = std::function<CancellationToken(
58-
const network::NetworkRequest&, const network::NetworkConfig&,
59-
const NetworkAsyncCallback&)>;
60-
6153
/**
6254
* @brief Default BackdownPolicy which simply returns the original wait time.
6355
*/
@@ -66,7 +58,7 @@ CORE_API unsigned int DefaultBackdownPolicy(unsigned int milliseconds);
6658
/**
6759
* @brief Default RetryCondition which is to disable retries.
6860
*/
69-
CORE_API bool DefaultRetryCondition(const HttpResponse& response);
61+
CORE_API bool DefaultRetryCondition(const olp::client::HttpResponse& response);
7062

7163
struct AuthenticationSettings {
7264
/**
@@ -165,20 +157,14 @@ struct OlpClientSettings {
165157
* @brief The network proxy settings to use. Set boost::none to remove any
166158
* exisitng proxy settings.
167159
*/
168-
boost::optional<network::NetworkProxy> proxy_settings = boost::none;
160+
boost::optional<http::NetworkProxySettings> proxy_settings = boost::none;
169161

170162
/**
171163
* @brief The authentication settings to use. Set boost::none to remove
172164
* any existing settings.
173165
*/
174166
boost::optional<AuthenticationSettings> authentication_settings = boost::none;
175167

176-
/**
177-
* @brief The network handler.
178-
* @deprecated since 0.7
179-
*/
180-
boost::optional<NetworkAsyncHandler> network_async_handler = boost::none;
181-
182168
/**
183169
* @brief The task scheduler instance. In case of nullptr set, all request
184170
* calls will be performed synchronous.

0 commit comments

Comments
 (0)