1
This commit is contained in:
parent
0fe638b889
commit
6e8c4a1387
@ -25,7 +25,6 @@ void UpStream::Init(int instance_id, const std::string& remote_ip, int remote_po
|
||||
|
||||
recv_bufflen_ = 0;
|
||||
last_pong_tick = a8::XGetTickCount();
|
||||
recv_buff_ = (char*) malloc(PACK_MAX * 2);
|
||||
tcp_client_ = std::make_shared<a8::TcpClient>();
|
||||
tcp_client_->remote_address = remote_ip;
|
||||
tcp_client_->remote_port = remote_port;
|
||||
@ -65,8 +64,6 @@ void UpStream::UnInit()
|
||||
abort();
|
||||
}
|
||||
recv_bufflen_ = 0;
|
||||
free(recv_buff_);
|
||||
recv_buff_ = nullptr;
|
||||
}
|
||||
|
||||
void UpStream::Open()
|
||||
@ -240,7 +237,7 @@ void UpStream::on_socketread(a8::TcpClient* sender, char* buf, unsigned int len)
|
||||
f8::UdpLog::Instance()->Debug("recvied bad package", {});
|
||||
}
|
||||
if (offset > 0 && offset < recv_bufflen_) {
|
||||
memmove(recv_buff_, recv_buff_ + offset, recv_bufflen_ - offset);
|
||||
memmove(recv_buff_.data(), recv_buff_.data() + offset, recv_bufflen_ - offset);
|
||||
}
|
||||
recv_bufflen_ -= offset;
|
||||
#if 1
|
||||
|
@ -64,7 +64,7 @@ class UpStream
|
||||
f8::MsgHdr* hdr);
|
||||
|
||||
private:
|
||||
char *recv_buff_ = nullptr;
|
||||
std::array<char, PACK_MAX> recv_buff_;
|
||||
unsigned int recv_bufflen_ = 0;
|
||||
std::shared_ptr<a8::TcpClient> tcp_client_;
|
||||
f8::TimerWp timer_wp_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user