mirror of
https://github.com/danog/libtgvoip.git
synced 2024-11-30 04:39:03 +01:00
I apparently still suck at C++ memory management
This commit is contained in:
parent
7f54b9109c
commit
beeea45d2e
@ -3431,6 +3431,8 @@ void VoIPController::UpdateQueuedPackets(){
|
||||
}
|
||||
|
||||
void VoIPController::SendNopPacket(){
|
||||
if(state!=STATE_ESTABLISHED)
|
||||
return;
|
||||
SendOrEnqueuePacket(PendingOutgoingPacket{
|
||||
/*.seq=*/(firstSentPing=GenerateOutSeq()),
|
||||
/*.type=*/PKT_NOP,
|
||||
|
@ -403,13 +403,11 @@ namespace tgvoip{
|
||||
double ackTime;
|
||||
};
|
||||
struct PendingOutgoingPacket{
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800 // VS2013 doesn't support auto-generating move constructors
|
||||
//TGVOIP_DISALLOW_COPY_AND_ASSIGN(PendingOutgoingPacket);
|
||||
PendingOutgoingPacket(uint32_t seq, unsigned char type, size_t len, Buffer&& data, int64_t endpoint){
|
||||
this->seq=seq;
|
||||
this->type=type;
|
||||
this->len=len;
|
||||
this->data=data;
|
||||
this->data=std::move(data);
|
||||
this->endpoint=endpoint;
|
||||
}
|
||||
PendingOutgoingPacket(PendingOutgoingPacket&& other){
|
||||
@ -419,7 +417,17 @@ namespace tgvoip{
|
||||
data=std::move(other.data);
|
||||
endpoint=other.endpoint;
|
||||
}
|
||||
#endif
|
||||
PendingOutgoingPacket& operator=(PendingOutgoingPacket&& other){
|
||||
if(this!=&other){
|
||||
seq=other.seq;
|
||||
type=other.type;
|
||||
len=other.len;
|
||||
data=std::move(other.data);
|
||||
endpoint=other.endpoint;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
TGVOIP_DISALLOW_COPY_AND_ASSIGN(PendingOutgoingPacket);
|
||||
uint32_t seq;
|
||||
unsigned char type;
|
||||
size_t len;
|
||||
|
Loading…
Reference in New Issue
Block a user