大幅提升接收推流性能以及降低内存占用

This commit is contained in:
xiongziliang
2020-11-01 03:41:35 +08:00
parent 5c7a08eb7c
commit 700a16c759
38 changed files with 173 additions and 193 deletions

View File

@@ -53,11 +53,11 @@ protected:
* @param buf 需要截取的数据
* @return 数据字节数
*/
int send(const Buffer::Ptr &buf) override {
int send(Buffer::Ptr buf) override {
if (_beforeSendCB) {
return _beforeSendCB(buf);
}
return TcpSessionType::send(buf);
return TcpSessionType::send(std::move(buf));
}
string getIdentifier() const override {
@@ -219,8 +219,8 @@ protected:
/**
* 发送数据进行websocket协议打包后回调
*/
void onWebSocketEncodeData(const Buffer::Ptr &buffer) override{
HttpSessionType::send(buffer);
void onWebSocketEncodeData(Buffer::Ptr buffer) override{
HttpSessionType::send(std::move(buffer));
}
private: