diff --git a/src/client/binary_client.cpp b/src/client/binary_client.cpp index 274f632b..9ee05b69 100644 --- a/src/client/binary_client.cpp +++ b/src/client/binary_client.cpp @@ -836,6 +836,8 @@ class BinaryClient const SymmetricAlgorithmHeader algorithmHeader = CreateAlgorithmHeader(); hdr.AddSize(RawSize(algorithmHeader)); + std::unique_lock send_lock(send_mutex); + const SequenceHeader sequence = CreateSequenceHeader(); hdr.AddSize(RawSize(sequence)); @@ -868,7 +870,7 @@ class BinaryClient std::unique_lock lock(Mutex); Callbacks.insert(std::make_pair(request.Header.RequestHandle, responseCallback)); lock.unlock(); - + LOG_DEBUG(Logger, "binary_client | send: id: {} handle: {}, UtcTime: {}", ToString(request.TypeId, true), request.Header.RequestHandle, request.Header.UtcTime); Send(request); @@ -903,11 +905,12 @@ class BinaryClient const SymmetricAlgorithmHeader algorithmHeader = CreateAlgorithmHeader(); hdr.AddSize(RawSize(algorithmHeader)); + std::unique_lock send_lock(send_mutex); + const SequenceHeader sequence = CreateSequenceHeader(); hdr.AddSize(RawSize(sequence)); hdr.AddSize(RawSize(request)); - std::unique_lock send_lock(send_mutex); Stream << hdr << algorithmHeader << sequence << request << flush; } @@ -1124,6 +1127,8 @@ void BinaryClient::Send(OpenSecureChannelRequest reque hdr.AddSize(RawSize(algorithmHeader)); hdr.AddSize(RawSize(request)); + std::unique_lock send_lock(send_mutex); + const SequenceHeader sequence = CreateSequenceHeader(); hdr.AddSize(RawSize(sequence)); Stream << hdr << algorithmHeader << sequence << request << flush;