Changeset 68d94de in network-game for common/MessageProcessor.cpp


Ignore:
Timestamp:
Dec 24, 2013, 3:02:22 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
8554263
Parents:
e1af80c
Message:

MessageProcessor now takes a socket and optional output log file as constructor arguments instead of accepting them as parameters in each method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/MessageProcessor.cpp

    re1af80c r68d94de  
    1313
    1414MessageProcessor::MessageProcessor() {
     15   this->sock = 0;
     16   this->outputLog = NULL;
     17   lastUsedId = 0;
     18}
     19
     20MessageProcessor::MessageProcessor(int sock, ofstream* outputLog) {
     21   this->sock = sock;
     22   this->outputLog = outputLog;
    1523   lastUsedId = 0;
    1624}
     
    1927}
    2028
    21 int MessageProcessor::sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest, ofstream* outputLog) {
     29int MessageProcessor::sendMessage(NETWORK_MSG *msg, struct sockaddr_in *dest) {
    2230   cout << "Sending message of type " << msg->type << endl;
    2331
     
    3543}
    3644
    37 int MessageProcessor::receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *source, ofstream* outputLog) {
     45int MessageProcessor::receiveMessage(NETWORK_MSG *msg, struct sockaddr_in *source) {
    3846   socklen_t socklen = sizeof(struct sockaddr_in);
    3947
     
    8492}
    8593
    86 void MessageProcessor::resendUnackedMessages(int sock, ofstream* outputLog) {
     94void MessageProcessor::resendUnackedMessages() {
    8795   map<unsigned int, map<unsigned long, MessageContainer> >::iterator it;
    8896   map<unsigned long, MessageContainer>::iterator it2;
     
    99107}
    100108
    101 void MessageProcessor::cleanAckedMessages(ofstream* outputLog) {
     109void MessageProcessor::cleanAckedMessages() {
    102110   map<unsigned int, map<unsigned long, MessageContainer> >::iterator it = sentMessages.begin();
    103111   map<unsigned long, MessageContainer>::iterator it2;
Note: See TracChangeset for help on using the changeset viewer.