mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 07:37:31 +02:00
Merge pull request #840 from birarda/master
repair header byte calculations in assignment server
This commit is contained in:
commit
a5459f8ab5
1 changed files with 2 additions and 3 deletions
|
@ -32,9 +32,8 @@ int main(int argc, const char* argv[]) {
|
||||||
|
|
||||||
UDPSocket serverSocket(ASSIGNMENT_SERVER_PORT);
|
UDPSocket serverSocket(ASSIGNMENT_SERVER_PORT);
|
||||||
|
|
||||||
int numHeaderBytes = numBytesForPacketHeader((unsigned char*) &PACKET_TYPE_SEND_ASSIGNMENT);
|
|
||||||
unsigned char assignmentPacket[MAX_PACKET_SIZE_BYTES];
|
unsigned char assignmentPacket[MAX_PACKET_SIZE_BYTES];
|
||||||
populateTypeAndVersion(assignmentPacket, PACKET_TYPE_SEND_ASSIGNMENT);
|
int numSendHeaderBytes = populateTypeAndVersion(assignmentPacket, PACKET_TYPE_SEND_ASSIGNMENT);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (serverSocket.receive((sockaddr*) &senderSocket, &senderData, &receivedBytes)) {
|
if (serverSocket.receive((sockaddr*) &senderSocket, &senderData, &receivedBytes)) {
|
||||||
|
@ -53,7 +52,7 @@ int main(int argc, const char* argv[]) {
|
||||||
qDebug() << "Sending assignment with URL" << scriptURL << "\n";
|
qDebug() << "Sending assignment with URL" << scriptURL << "\n";
|
||||||
|
|
||||||
int scriptURLBytes = scriptURL.size();
|
int scriptURLBytes = scriptURL.size();
|
||||||
memcpy(assignmentPacket + numHeaderBytes, scriptURL.toLocal8Bit().constData(), scriptURLBytes);
|
memcpy(assignmentPacket + numSendHeaderBytes, scriptURL.toLocal8Bit().constData(), scriptURLBytes);
|
||||||
|
|
||||||
// send the assignment
|
// send the assignment
|
||||||
serverSocket.send((sockaddr*) &senderSocket, assignmentPacket, numHeaderBytes + scriptURLBytes);
|
serverSocket.send((sockaddr*) &senderSocket, assignmentPacket, numHeaderBytes + scriptURLBytes);
|
||||||
|
|
Loading…
Reference in a new issue