Fix copying over data of received packet
This commit is contained in:
parent
1a39039065
commit
89bdc7e9ca
1 changed files with 6 additions and 6 deletions
|
@ -1659,10 +1659,10 @@ void UDPC::Context::update_impl() {
|
||||||
|
|
||||||
if(pktType == 0 && bytes > (int)UDPC_NSFULL_HEADER_SIZE) {
|
if(pktType == 0 && bytes > (int)UDPC_NSFULL_HEADER_SIZE) {
|
||||||
UDPC_PacketInfo recPktInfo = UDPC::get_empty_pinfo();
|
UDPC_PacketInfo recPktInfo = UDPC::get_empty_pinfo();
|
||||||
std::memcpy(recPktInfo.data + UDPC_NSFULL_HEADER_SIZE,
|
|
||||||
recvBuf,
|
|
||||||
bytes - UDPC_NSFULL_HEADER_SIZE);
|
|
||||||
recPktInfo.dataSize = bytes - UDPC_NSFULL_HEADER_SIZE;
|
recPktInfo.dataSize = bytes - UDPC_NSFULL_HEADER_SIZE;
|
||||||
|
std::memcpy(recPktInfo.data,
|
||||||
|
recvBuf + UDPC_NSFULL_HEADER_SIZE,
|
||||||
|
recPktInfo.dataSize);
|
||||||
recPktInfo.flags =
|
recPktInfo.flags =
|
||||||
(isConnect ? 0x1 : 0)
|
(isConnect ? 0x1 : 0)
|
||||||
| (isPing ? 0x2 : 0)
|
| (isPing ? 0x2 : 0)
|
||||||
|
@ -1677,10 +1677,10 @@ void UDPC::Context::update_impl() {
|
||||||
receivedPkts.push(recPktInfo);
|
receivedPkts.push(recPktInfo);
|
||||||
} else if(pktType == 1 && bytes > (int)UDPC_LSFULL_HEADER_SIZE) {
|
} else if(pktType == 1 && bytes > (int)UDPC_LSFULL_HEADER_SIZE) {
|
||||||
UDPC_PacketInfo recPktInfo = UDPC::get_empty_pinfo();
|
UDPC_PacketInfo recPktInfo = UDPC::get_empty_pinfo();
|
||||||
std::memcpy(recPktInfo.data + UDPC_LSFULL_HEADER_SIZE,
|
|
||||||
recvBuf,
|
|
||||||
bytes - UDPC_LSFULL_HEADER_SIZE);
|
|
||||||
recPktInfo.dataSize = bytes - UDPC_LSFULL_HEADER_SIZE;
|
recPktInfo.dataSize = bytes - UDPC_LSFULL_HEADER_SIZE;
|
||||||
|
std::memcpy(recPktInfo.data,
|
||||||
|
recvBuf + UDPC_LSFULL_HEADER_SIZE,
|
||||||
|
recPktInfo.dataSize);
|
||||||
recPktInfo.flags =
|
recPktInfo.flags =
|
||||||
(isConnect ? 0x1 : 0)
|
(isConnect ? 0x1 : 0)
|
||||||
| (isPing ? 0x2 : 0)
|
| (isPing ? 0x2 : 0)
|
||||||
|
|
Loading…
Reference in a new issue