mirror of
https://github.com/sogou/workflow.git
synced 2026-02-08 01:33:17 +08:00
Keep message wrapper available when clearing. (#1611)
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
#include <time.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <new>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
@@ -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()
|
||||
|
||||
@@ -112,11 +112,9 @@ public:
|
||||
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)
|
||||
@@ -124,12 +122,10 @@ public:
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user