Skip to content

Commit

Permalink
Keep message wrapper available when clearing. (#1611)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barenboim authored Aug 19, 2024
1 parent 218681e commit 0c11e8c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
9 changes: 3 additions & 6 deletions src/factory/WFTaskFactory.inl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <time.h>
#include <netdb.h>
#include <stdio.h>
#include <new>
#include <string>
#include <functional>
#include <utility>
Expand Down Expand Up @@ -161,11 +160,9 @@ protected:

void clear_resp()
{
protocol::ProtocolMessage msg(std::move(this->resp));

this->resp.~RESP();
new(&this->resp) RESP;
*(protocol::ProtocolMessage *)&this->resp = std::move(msg);
RESP resp;
*(protocol::ProtocolMessage *)&resp = std::move(this->resp);
this->resp = std::move(resp);
}

void disable_retry()
Expand Down
4 changes: 0 additions & 4 deletions src/protocol/ProtocolMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,20 @@ class ProtocolMessage : public CommMessageOut, public CommMessageIn
ProtocolMessage(ProtocolMessage&& message)
{
this->size_limit = message.size_limit;
message.size_limit = (size_t)-1;
this->attachment = message.attachment;
message.attachment = NULL;
this->wrapper = message.wrapper;
message.wrapper = NULL;
}

ProtocolMessage& operator = (ProtocolMessage&& message)
{
if (&message != this)
{
this->size_limit = message.size_limit;
message.size_limit = (size_t)-1;
delete this->attachment;
this->attachment = message.attachment;
message.attachment = NULL;
this->wrapper = message.wrapper;
message.wrapper = NULL;
}

return *this;
Expand Down

0 comments on commit 0c11e8c

Please sign in to comment.