Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1246


Ignore:
Timestamp:
May 7, 2008, 5:34:35 PM (17 years ago)
Author:
scheusso
Message:

fixed some memory leaks (not all though)

Location:
code/branches/network3/src/network
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network3/src/network/Client.cc

    r1245 r1246  
    235235        COUT(4) << "client tick: sending gs " << gs << std::endl;
    236236        if(client_connection.addPacket(pck_gen.gstate(gs)))
    237           if(!client_connection.sendPackets())
    238             COUT(3) << "Problem sending partial gamestate" << std::endl;
     237          COUT(3) << "Problem adding partial gamestate to queue" << std::endl;
    239238        // now delete it to save memory
    240239        delete [] gs->data;
     
    251250      }
    252251    }
     252    if(!client_connection.sendPackets())
     253      COUT(3) << "Problem sending packets to server" << std::endl;
    253254    return;
    254255  }
     
    260261      if(gamestate.pushGameState(data)){
    261262        client_connection.addPacket(pck_gen.acknowledgement(id));
    262         if(!client_connection.sendPackets())
    263           COUT(2) << "Could not send acknowledgment" << std::endl;
     263        // we do this at the end of a tick
     264//        if(!client_connection.sendPackets())
     265//          COUT(2) << "Could not send acknowledgment" << std::endl;
    264266      }
    265267//       test_once=true;
  • code/branches/network3/src/network/ConnectionManager.cc

    r1245 r1246  
    199199          break;
    200200      }
    201 //       usleep(1000);
     201      usleep(100);
    202202      //yield(); //TODO: find apropriate
    203203    }
  • code/branches/network3/src/network/GameStateClient.cc

    r1245 r1246  
    289289
    290290    switch ( retval ) {
    291       case Z_OK: COUT(5) << "G.St.Man: compress: successfully compressed" << std::endl; break;
    292       case Z_MEM_ERROR: COUT(1) << "G.St.Man: compress: not enough memory available in gamestate.compress" << std::endl;
    293       return NULL;
    294       case Z_BUF_ERROR: COUT(2) << "G.St.Man: compress: not enough memory available in the buffer in gamestate.compress" << std::endl;
    295       return NULL;
    296       case Z_DATA_ERROR: COUT(2) << "G.St.Man: compress: data corrupted in gamestate.compress" << std::endl;
     291      case Z_OK: COUT(5) << "G.St.Cl: compress: successfully compressed" << std::endl; break;
     292      case Z_MEM_ERROR: COUT(1) << "G.St.Cl: compress: not enough memory available in gamestate.compress" << std::endl;
     293      return NULL;
     294      case Z_BUF_ERROR: COUT(2) << "G.St.Cl: compress: not enough memory available in the buffer in gamestate.compress" << std::endl;
     295      return NULL;
     296      case Z_DATA_ERROR: COUT(2) << "G.St.Cl: compress: data corrupted in gamestate.compress" << std::endl;
    297297      return NULL;
    298298    }
  • code/branches/network3/src/network/GameStateManager.cc

    r1245 r1246  
    260260      ++it;
    261261    }
    262 
     262   
     263    delete[] state->data;
     264    delete state;
    263265    return true;
    264266  }
  • code/branches/network3/src/network/Server.cc

    r1245 r1246  
    210210      added=true;
    211211      temp=temp->next();
     212      // now delete gamestate
     213      delete[] gs->data;
     214      delete gs;
    212215    }
    213216    if(added) {
     
    222225    COUT(4) << "Server: processing ack from client: " << clientID << "; ack-id: " << data->a << std::endl;
    223226    gamestates->ackGameState(clientID, data->a);
     227    delete data;
    224228  }
    225229 
     
    235239    if(!gamestates->pushGameState(data, clientID))
    236240        COUT(3) << "Could not push gamestate\t\t\t\t=====" << std::endl;
    237 //     delete[] data->data;
    238 //     delete data;
    239241  }
    240242
Note: See TracChangeset for help on using the changeset viewer.