Skip to content

Commit 2a9401b

Browse files
authored
Move close(pipe_[]) from Teardown to Deinitialize (#1648)
It removes possibility close and write will appear simultaneously in different threads Relates-To: NLAM-166 Signed-off-by: Alexander Sopov <[email protected]>
1 parent b7ef8b0 commit 2a9401b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,11 @@ void NetworkCurl::Deinitialize() {
558558
}
559559
#endif
560560
thread_.join();
561+
562+
#if (defined OLP_SDK_NETWORK_HAS_PIPE) || (defined OLP_SDK_NETWORK_HAS_PIPE2)
563+
close(pipe_[0]);
564+
close(pipe_[1]);
565+
#endif
561566
} else {
562567
// We are trying to stop the very thread we are in. This is not recommended,
563568
// but we try to handle it gracefully. This could happen by calling from one
@@ -589,11 +594,6 @@ void NetworkCurl::Teardown() {
589594
// cURL teardown
590595
curl_multi_cleanup(curl_);
591596
curl_ = nullptr;
592-
593-
#if (defined OLP_SDK_NETWORK_HAS_PIPE) || (defined OLP_SDK_NETWORK_HAS_PIPE2)
594-
close(pipe_[0]);
595-
close(pipe_[1]);
596-
#endif
597597
}
598598

599599
// Handle completed messages

0 commit comments

Comments
 (0)