bakaid commented on a change in pull request #713: MINIFICPP-1119
MINIFICPP-1154 unify win/posix sockets + fix bugs
URL: https://github.com/apache/nifi-minifi-cpp/pull/713#discussion_r392903802
##########
File path: libminifi/src/io/tls/TLSSocket.cpp
##########
@@ -170,23 +175,38 @@ void TLSSocket::closeStream() {
* @param listeners number of listeners in the queue
*/
TLSSocket::TLSSocket(const std::shared_ptr<TLSContext> &context, const
std::string &hostname, const uint16_t port, const uint16_t listeners)
- : Socket(context, hostname, port, listeners),
- ssl_(0) {
+ : Socket(context, hostname, port, listeners) {
logger_ = logging::LoggerFactory<TLSSocket>::getLogger();
context_ = context;
}
TLSSocket::TLSSocket(const std::shared_ptr<TLSContext> &context, const
std::string &hostname, const uint16_t port)
- : Socket(context, hostname, port, 0),
- ssl_(0) {
+ : Socket(context, hostname, port, 0) {
logger_ = logging::LoggerFactory<TLSSocket>::getLogger();
context_ = context;
}
-TLSSocket::TLSSocket(const TLSSocket &&d)
- : Socket(std::move(d)),
- ssl_(0) {
- context_ = d.context_;
+TLSSocket::TLSSocket(TLSSocket &&other) noexcept
+ : Socket(std::move(other)),
+ context_{ utils::exchange(other.context_, nullptr) } {
+ std::lock_guard<std::mutex> lg{ other.ssl_mutex_ };
Review comment:
std::mutex::lock() (and, consequently std::lock_guard::lock_guard()) can
throw, so neither this, nor the move assignment operator can be `noexcept`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services