MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / MultiDoFileAck

Function MultiDoFileAck

Descent3/multi.cpp:7843–7862  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7841}
7842
7843void MultiDoFileAck(uint8_t *data) {
7844 // If we are transferring a file, and someone ACK's us, simply send them the next bit of data they are waiting for
7845 uint8_t playernum; // Who is acking us
7846 uint32_t len_recvd; // Total number of bytes received so far
7847 int count = 0;
7848
7849 SKIP_HEADER(data, &count);
7850 playernum = MultiGetUshort(data, &count);
7851 len_recvd = MultiGetUint(data, &count);
7852 // mprintf(0,"Got a ACK packet from %d\n",playernum);
7853 if (NetPlayers[playernum].file_xfer_flags == NETFILE_SENDING) {
7854 if (NetPlayers[playernum].file_xfer_pos == len_recvd) {
7855 SendDataChunk(playernum);
7856 } else {
7857 Int3(); // This shouldn't happen because the reliable network code should handle it
7858 }
7859 } else {
7860 mprintf(0, "Received an ACK from someone we weren't sending a file to!\n");
7861 }
7862}
7863
7864void SendDataChunk(int playernum) {
7865 int outcount = 0;

Callers 1

MultiProcessDataFunction · 0.85

Calls 4

SKIP_HEADERFunction · 0.85
MultiGetUshortFunction · 0.85
MultiGetUintFunction · 0.85
SendDataChunkFunction · 0.85

Tested by

no test coverage detected