Make Communicator::push() works with multiple message wrappers.

This commit is contained in:
Xie Han
2024-07-24 21:34:59 +08:00
committed by xiehan
parent e64c02ec16
commit 557b515a7f
3 changed files with 12 additions and 1 deletions

View File

@@ -2004,7 +2004,7 @@ int Communicator::push(const void *buf, size_t size, CommSession *session)
(!session->passive && in->entry->session == session) ||
session->passive == 1)
{
ret = in->CommMessageIn::feedback(buf, size);
ret = in->inner()->feedback(buf, size);
}
else
{

View File

@@ -116,6 +116,9 @@ protected:
/* In append(), reset the begin time of receiving to current time. */
virtual void renew();
/* Return the deepest wrapped message. */
virtual CommMessageIn *inner() { return this; }
private:
struct CommConnEntry *entry;

View File

@@ -89,6 +89,8 @@ protected:
return this->CommMessageIn::renew();
}
virtual ProtocolMessage *inner() { return this; }
protected:
size_t size_limit;
@@ -145,6 +147,12 @@ protected:
return this->msg->append(buf, size);
}
protected:
virtual ProtocolMessage *inner()
{
return this->msg->inner();
}
protected:
ProtocolMessage *msg;