1
This commit is contained in:
parent
e24aab092d
commit
afffb63a95
@ -14,6 +14,7 @@ namespace a8
|
|||||||
UdpSession::UdpSession()
|
UdpSession::UdpSession()
|
||||||
{
|
{
|
||||||
max_packet_len_ = DEFAULT_MAX_PACKET_LEN;
|
max_packet_len_ = DEFAULT_MAX_PACKET_LEN;
|
||||||
|
SetMaxPacketLen(max_packet_len_);
|
||||||
}
|
}
|
||||||
|
|
||||||
UdpSession::~UdpSession()
|
UdpSession::~UdpSession()
|
||||||
@ -33,6 +34,10 @@ namespace a8
|
|||||||
void UdpSession::SetMaxPacketLen(int max_packet_len)
|
void UdpSession::SetMaxPacketLen(int max_packet_len)
|
||||||
{
|
{
|
||||||
max_packet_len_ = std::max(max_packet_len, DEFAULT_MAX_PACKET_LEN);
|
max_packet_len_ = std::max(max_packet_len, DEFAULT_MAX_PACKET_LEN);
|
||||||
|
if (!recv_buff_) {
|
||||||
|
recv_buff_ = (char *)malloc(max_packet_len_ + 1);
|
||||||
|
}
|
||||||
|
recv_bufflen_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UdpSession::OnSocketRead(char* buf, unsigned int buflen)
|
void UdpSession::OnSocketRead(char* buf, unsigned int buflen)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user