Changeset 6b641af in network-game for common/MessageProcessor.cpp
- Timestamp:
- Jul 16, 2013, 1:06:57 AM (11 years ago)
- Branches:
- master
- Children:
- 4dbac87
- Parents:
- 5755e68
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
common/MessageProcessor.cpp
r5755e68 r6b641af 35 35 int ret = recvfrom(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)source, &socklen); 36 36 37 if (ret == -1) 38 return ret; 39 37 40 // add id to the NETWORK_MSG struct 38 41 if (msg->type == MSG_TYPE_ACK) { … … 41 44 sentMessages[msg->id].isAcked = true; 42 45 sentMessages[msg->id].timeAcked = getCurrentMillis(); 43 }else 44 cout << "Received old ack" << endl; 46 } 45 47 46 48 return -1; // don't do any further processing … … 75 77 76 78 while (it != sentMessages.end()) { 77 if (it->second.isAcked && (getCurrentMillis() - it->second.timeAcked) > 1000) 78 sentMessages.erase(it++); 79 else 79 if (it->second.isAcked) { 80 // cout << "Found acked message" << endl; 81 // cout << "time acked" << it->second.timeAcked << endl; 82 // cout << "cur time" << getCurrentMillis() << endl; 83 if ((getCurrentMillis() - it->second.timeAcked) > 1000) { 84 cout << "Message was acked. time to delete it" << endl; 85 cout << "old map size" << sentMessages.size() << endl; 86 sentMessages.erase(it++); 87 cout << "new map size" << sentMessages.size() << endl; 88 }else 89 it++; 90 }else 80 91 it++; 81 92 }
Note:
See TracChangeset
for help on using the changeset viewer.