Last change
on this file since f9cb9fb was f9cb9fb, checked in by dportnoy <dmp1488@…>, 11 years ago |
The ackedMessages list in MessageProcessor now stores ack records based on sender address and message id so that messages with the same id, but from different senders are distinguishable
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[1a3c42d] | 1 | #ifndef _MESSAGE_PROCESSOR_H
|
---|
| 2 | #define _MESSAGE_PROCESSOR_H
|
---|
| 3 |
|
---|
[5a64bea] | 4 | #include <map>
|
---|
| 5 |
|
---|
[46d6469] | 6 | #include "MessageContainer.h"
|
---|
[5a64bea] | 7 |
|
---|
[46d6469] | 8 | using namespace std;
|
---|
[5a64bea] | 9 |
|
---|
[46d6469] | 10 | class MessageProcessor {
|
---|
| 11 | private:
|
---|
| 12 | int lastUsedId;
|
---|
[1a3c42d] | 13 |
|
---|
[46d6469] | 14 | // map from message ids to maps from player addresses to message info
|
---|
[b35b2b2] | 15 | map<unsigned int, map<unsigned long, MessageContainer> > sentMessages;
|
---|
[1a3c42d] | 16 |
|
---|
[f9cb9fb] | 17 | // map from player address to map from message id to time accked
|
---|
| 18 | map<unsigned long, map<unsigned int, unsigned long long> > ackedMessages;
|
---|
[46d6469] | 19 |
|
---|
| 20 | unsigned long pid;
|
---|
[5a64bea] | 21 |
|
---|
[1a3c42d] | 22 | public:
|
---|
[5a64bea] | 23 | MessageProcessor();
|
---|
| 24 | ~MessageProcessor();
|
---|
| 25 |
|
---|
[d05086b] | 26 | int sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest, ofstream* outputLog = NULL);
|
---|
| 27 | int receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest, ofstream* outputLog = NULL);
|
---|
| 28 | void resendUnackedMessages(int sock, ofstream* outputLog = NULL);
|
---|
| 29 | void cleanAckedMessages(ofstream* outputLog = NULL);
|
---|
[b35b2b2] | 30 |
|
---|
| 31 | map<unsigned int, map<unsigned long, MessageContainer> >& getSentMessages();
|
---|
[f9cb9fb] | 32 | map<unsigned long, map<unsigned int, unsigned long long> >& getAckedMessages();
|
---|
[1a3c42d] | 33 | };
|
---|
| 34 |
|
---|
| 35 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.