add ProtocolMessage attachment

This commit is contained in:
XieHan
2021-01-27 19:54:24 +08:00
parent 2da1aee6cb
commit c344ef41d6
5 changed files with 39 additions and 1 deletions
+6
View File
@@ -227,6 +227,9 @@ HttpMessage::HttpMessage(HttpMessage&& msg)
this->size_limit = msg.size_limit;
msg.size_limit = (size_t)-1;
this->attachment = msg.attachment;
msg.attachment = NULL;
this->parser = msg.parser;
msg.parser = NULL;
@@ -246,6 +249,9 @@ HttpMessage& HttpMessage::operator = (HttpMessage&& msg)
this->size_limit = msg.size_limit;
msg.size_limit = (size_t)-1;
this->attachment = msg.attachment;
msg.attachment = NULL;
http_parser_deinit(this->parser);
delete this->parser;
+6
View File
@@ -1625,6 +1625,9 @@ KafkaMessage::KafkaMessage(KafkaMessage&& msg)
this->size_limit = msg.size_limit;
msg.size_limit = (size_t)-1;
this->attachment = msg.attchment;
msg.attachment = NULL;
this->parser = msg.parser;
this->stream = msg.stream;
msg.parser = NULL;
@@ -1654,6 +1657,9 @@ KafkaMessage& KafkaMessage::operator= (KafkaMessage &&msg)
this->size_limit = msg.size_limit;
msg.size_limit = (size_t)-1;
this->attachment = msg.attchment;
msg.attachment = NULL;
kafka_parser_deinit(this->parser);
delete this->parser;
delete this->stream;
+6
View File
@@ -46,6 +46,9 @@ MySQLMessage::MySQLMessage(MySQLMessage&& move)
this->size_limit = move.size_limit;
move.size_limit = (size_t)-1;
this->attachment = move.attachment;
move.attachment = NULL;
parser_ = move.parser_;
stream_ = move.stream_;
seqid_ = move.seqid_;
@@ -64,6 +67,9 @@ MySQLMessage& MySQLMessage::operator= (MySQLMessage&& move)
this->size_limit = move.size_limit;
move.size_limit = (size_t)-1;
this->attachment = move.attachment;
move.attachment = NULL;
mysql_parser_deinit(parser_);
mysql_stream_deinit(stream_);
delete parser_;
+18 -1
View File
@@ -61,11 +61,28 @@ public:
void set_size_limit(size_t limit) { this->size_limit = limit; }
size_t get_size_limit() const { return this->size_limit; }
public:
class Attachment
{
public:
virtual ~Attachment() { }
};
void set_attachment(Attachment *att) { this->attachment = att; }
Attachment *get_attachment() const { return this->attachment; }
protected:
size_t size_limit;
Attachment *attachment;
public:
ProtocolMessage() { this->size_limit = (size_t)-1; }
ProtocolMessage()
{
this->size_limit = (size_t)-1;
this->attachment = NULL;
}
virtual ~ProtocolMessage() { delete this->attachment; }
};
}
+3
View File
@@ -490,6 +490,9 @@ RedisMessage::RedisMessage(RedisMessage&& move)
this->size_limit = move.size_limit;
move.size_limit = (size_t)-1;
this->attachment = move.attachment;
move.attachment = NULL;
parser_ = move.parser_;
stream_ = move.stream_;
cur_size_ = move.cur_size_;