Fix prepare_pkt function
This commit is contained in:
parent
bf3f3c334e
commit
537fef9e8a
2 changed files with 12 additions and 19 deletions
|
@ -940,11 +940,11 @@ void UDPC_INTERNAL_update_send(void *userData, uint32_t addr, char *data)
|
||||||
UDPC_INTERNAL_prepare_pkt(
|
UDPC_INTERNAL_prepare_pkt(
|
||||||
data,
|
data,
|
||||||
us->ctx->protocolID,
|
us->ctx->protocolID,
|
||||||
UDPC_ID_CONNECT,
|
0,
|
||||||
0,
|
0,
|
||||||
0xFFFFFFFF,
|
0xFFFFFFFF,
|
||||||
NULL,
|
NULL,
|
||||||
0);
|
0x8);
|
||||||
|
|
||||||
struct sockaddr_in destinationInfo;
|
struct sockaddr_in destinationInfo;
|
||||||
destinationInfo.sin_family = AF_INET;
|
destinationInfo.sin_family = AF_INET;
|
||||||
|
@ -976,11 +976,11 @@ void UDPC_INTERNAL_update_send(void *userData, uint32_t addr, char *data)
|
||||||
UDPC_INTERNAL_prepare_pkt(
|
UDPC_INTERNAL_prepare_pkt(
|
||||||
data,
|
data,
|
||||||
us->ctx->protocolID,
|
us->ctx->protocolID,
|
||||||
UDPC_ID_CONNECT | cd->id,
|
cd->id,
|
||||||
cd->rseq,
|
cd->rseq,
|
||||||
cd->ack,
|
cd->ack,
|
||||||
&cd->lseq,
|
&cd->lseq,
|
||||||
0);
|
0x8);
|
||||||
|
|
||||||
struct sockaddr_in destinationInfo;
|
struct sockaddr_in destinationInfo;
|
||||||
destinationInfo.sin_family = AF_INET;
|
destinationInfo.sin_family = AF_INET;
|
||||||
|
@ -1362,21 +1362,13 @@ void UDPC_INTERNAL_prepare_pkt(
|
||||||
|
|
||||||
temp = htonl(protocolID);
|
temp = htonl(protocolID);
|
||||||
memcpy(d, &temp, 4);
|
memcpy(d, &temp, 4);
|
||||||
if((flags & 0x4) == 0)
|
|
||||||
{
|
temp = htonl(conID
|
||||||
temp = htonl(conID | UDPC_ID_NO_REC_CHK);
|
| ((flags & 0x1) != 0 ? UDPC_ID_PING : 0)
|
||||||
memcpy(&d[4], &temp, 4);
|
| ((flags & 0x2) != 0 ? UDPC_ID_RESENDING : 0)
|
||||||
}
|
| ((flags & 0x4) == 0 ? UDPC_ID_NO_REC_CHK : 0)
|
||||||
else if((flags & 0x1) != 0)
|
| ((flags & 0x8) != 0 ? UDPC_ID_CONNECT : 0));
|
||||||
{
|
memcpy(&d[4], &temp, 4);
|
||||||
temp = htonl(conID | UDPC_ID_PING);
|
|
||||||
memcpy(&d[4], &temp, 4);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
temp = htonl(conID | ((flags & 0x2) != 0 ? UDPC_ID_RESENDING : 0));
|
|
||||||
memcpy(&d[4], &temp, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(seqID)
|
if(seqID)
|
||||||
{
|
{
|
||||||
|
|
|
@ -286,6 +286,7 @@ int UDPC_INTERNAL_threadfn(void *context);
|
||||||
* 0x1 - is ping
|
* 0x1 - is ping
|
||||||
* 0x2 - is resending
|
* 0x2 - is resending
|
||||||
* 0x4 - is checked received packet
|
* 0x4 - is checked received packet
|
||||||
|
* 0x8 - is init connection packet
|
||||||
*/
|
*/
|
||||||
void UDPC_INTERNAL_prepare_pkt(
|
void UDPC_INTERNAL_prepare_pkt(
|
||||||
void *data,
|
void *data,
|
||||||
|
|
Loading…
Reference in a new issue