Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7778 in orxonox.OLD for branches


Ignore:
Timestamp:
May 23, 2006, 4:35:08 PM (19 years ago)
Author:
rennerc
Message:

reverted some files

Location:
branches/network/src/lib/network
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/connection_monitor.cc

    r7772 r7778  
    3333  this->incomingUnzippedBandWidth = 0;
    3434  this->outgoingUnzippedBandWidth = 0;
    35   this->incomingZippedBandWidth = 0;
    36   this->outgoingZippedBandWidth = 0;
    3735  this->nIncomingPackets = 0;
    3836  this->nOutgoingPackets = 0;
     
    6462 
    6563  for ( int i = 0; i < length; i++ )
    66   {
    6764    if ( data[i] == '\0' )
    6865      nZeroBytes++;
    69   }
    7066 
    7167  NETPRINTF(n)( "ZEROBYTES: %d (%f%%)\n", nZeroBytes, ((float)100)*nZeroBytes/length );
     
    8682  }
    8783     
    88   //TODO cleanup list
    89 //  while ( sentStateTicks.begin()->first <= ackedState )
    90 //  {
    91 //    NETPRINTF(n)("removing old state\n");
    92 //    sentStateTicks.erase( sentStateTicks.begin() );
    93 //  }
    94  
    95   NETPRINTF(n)("adsf\n");
     84  while ( sentStateTicks.begin()->first <= ackedState )
     85    sentStateTicks.erase( sentStateTicks.begin() );
    9686     
    97   //TODO cleanup list
    98 #if 0
    9987  while ( ackDelay.size() > N_PACKETS_FOR_PING )
    100   {
    101     NETPRINTF(n)("removing old ackdelay\n");
    10288    ackDelay.erase( ackDelay.begin() );
    103   }
    104 #endif
    10589     
    10690  ping = 0;
     
    128112  // delete old packets
    129113  while ( packetHistory.begin()->first < tick - MSECS_TO_CALC_BWIDTH )
    130   {
    131114    packetHistory.erase( packetHistory.begin() );
    132   }
    133115 
    134116  float res = 0.0f;
     
    149131}
    150132
    151 /**
    152  * calculates max packet size you can send now to fit into bandwidth
    153  * @return
    154  */
    155 int ConnectionMonitor::getMaxPacketSize( )
    156 {
    157 }
    158133
    159 
  • branches/network/src/lib/network/connection_monitor.h

    r7776 r7778  
    2424    void processUnzippedOutgoingPacket( byte * data, int length, int stateId );
    2525    void processUnzippedIncomingPacket( byte * data, int length, int stateId, int ackedState );
    26 
     26    void processZippedPacket(  );
    2727   
    2828    void calculatePing();
    2929   
    30     //TODO
    31     bool hasTimedOut(){ return false; return ( lastPacketTick + SECS_TO_TIMEOUT*1000 < SDL_GetTicks() ) && nIncomingPackets > 0; }
    32    
    33     int getMaxPacketSize();
     30    bool hasTimedOut(){ return ( lastPacketTick + SECS_TO_TIMEOUT*1000 < SDL_GetTicks() ) && nIncomingPackets > 0; }
    3431   
    3532  private:
     
    4340    std::map<int,int>   outgoingUnzippedPacketHistory;
    4441   
    45     std::map<int,int>   incomingZippedPacketHistory;
    46     std::map<int,int>   outgoingZippedPacketHistory;
    47    
    4842    std::list<int>      ackDelay;
    4943    int                 ping;
     
    5145    float               incomingUnzippedBandWidth;
    5246    float               outgoingUnzippedBandWidth;
    53    
    54     float               incomingZippedBandWidth;
    55     float               outgoingZippedBandWidth;
    5647   
    5748    int                 nIncomingPackets;
  • branches/network/src/lib/network/handshake.cc

    r7777 r7778  
    2222#include "handshake.h"
    2323
    24 #include "network_log.h"
    25 
    2624#include <cassert>
    2725
     
    4341  errorString_handler = registerVarId( new SynchronizeableString( &localState.errorString, &remoteState.errorString, "errorString", PERMISSION_ALL ) );
    4442 
    45   localState.completed = 0;
     43  localState.completed = false;
    4644  localState.error = 0;
    4745  localState.errorString = "";
     
    5250  localState.version = _ORXONOX_VERSION;
    5351 
    54   remoteState.completed = 0;
     52  remoteState.completed = false;
    5553  remoteState.error = 0;
    5654  remoteState.errorString = "";
     
    7876      {
    7977        localState.error = 1;
    80         localState.completed = 1;
    81         PRINTF(0)("orxId: %d:%d", remoteState.orxId, _ORXONOX_ID);
    82         localState.errorString = "Seems not to be orxonox!\n";
     78        localState.completed = true;
     79        localState.errorString = "Seems not to be orxonox!";
    8380        return;
    8481      }
    8582      else
    86         if ( remoteState.version -= _ORXONOX_VERSION )
    87           localState.completed = 1;
     83        localState.completed = true;
    8884    }
    8985     
     
    9389      {
    9490        localState.error = 2;
    95         localState.completed = 1;
    96         PRINTF(0)("version: %d:%d", remoteState.version, _ORXONOX_VERSION);
    97         localState.errorString = "Versions of server and client do not match!\n";
     91        localState.completed = true;
     92        localState.errorString = "Versions of server and client do not match!";
    9893        return;
    9994      }
    10095      else
    101         if ( remoteState.orxId == _ORXONOX_ID )
    102           localState.completed = 1;
     96        localState.completed = true;
    10397    }
    10498   
    10599  }
    106  
    107   PRINTF(0)("=======================BEGIN=============================\n");
    108   for ( std::list<int>::iterator it = id.begin(); it != id.end(); it++ )
    109   {
    110     if ( *it == netManId_handler )
    111       PRINTF(0)("netManId_handler\n");
    112     if ( *it == msgManId_handler )
    113       PRINTF(0)("msgManId_handler\n");
    114     if ( *it == hostId_handler )
    115       PRINTF(0)("hostId_handler\n");
    116     if ( *it == completed_handler )
    117       PRINTF(0)("completed_handler\n");
    118     if ( *it == error_handler )
    119       PRINTF(0)("error_handler\n");
    120     if ( *it == errorString_handler )
    121       PRINTF(0)("errorString_handler\n");
    122     if ( *it == orxId_handler )
    123       PRINTF(0)("orxId_handler\n");
    124     if ( *it == version_handler )
    125       PRINTF(0)("version_handler\n");
    126   }
    127   PRINTF(0)("=========================================================\n");
    128100}
    129101
  • branches/network/src/lib/network/handshake.h

    r7777 r7778  
    3939    inline int        getMessageManagerId(){ return remoteState.messageManagerId; }
    4040    inline void       doReject( std::string reason ){ localState.error = 1; localState.errorString = "the server rejected your connection ["+ reason +"]"; }
    41     inline std::string getErrorString(){ return remoteState.errorString; }
    4241   
    4342    virtual void varChangeHandler( std::list<int> & id );
  • branches/network/src/lib/network/network_game_manager.cc

    r7772 r7778  
    467467{
    468468  /* create new playable for Player*/
    469 
    470   assert ( SharedNetworkData::getInstance()->isGameServer() );
    471 
    472469  PRINTF(0)("Request for creation: %i\n", userId);
    473470  int uniqueId = this->createEntity(CL_SPACE_SHIP, userId);
  • branches/network/src/lib/network/network_log.h

    r7770 r7778  
    99#include "netdefs.h"
    1010#include "debug.h"
    11 
     11#include "SDL_net.h"
    1212
    1313#include <string>
     
    4444    /** @returns a Pointer to the only object of this Class */
    4545    inline static NetworkLog* getInstance(void) { if (!singletonRef) singletonRef = new NetworkLog();  return singletonRef; };
    46 
     46   
    4747    bool listen( int port );
    48 
     48   
    4949    void printfnet( );
    50 
     50   
    5151    void printfn( char * format, ... );
    5252    void printf0( char * format, ... );
     
    5959  private:
    6060    NetworkLog();
    61 
     61   
    6262    void acceptNewConnections();
    63 
     63   
    6464    static NetworkLog* singletonRef;
    65 
     65   
    6666    TCPsocket listensock;
    6767    std::list<TCPsocket> sockets;
    68 
     68   
    6969    char buf[NETWORK_LOG_BUFLEN];
    7070};
  • branches/network/src/lib/network/network_stream.cc

    r7777 r7778  
    336336            this->networkGameManager->setUniqueID( it->second.handshake->getNetworkGameManagerId() );
    337337            MessageManager::getInstance()->setUniqueID( it->second.handshake->getMessageManagerId() );
    338 
    339           }
    340           else
    341             handleNewClient( it->second.userId );
    342 
    343           PRINTF(0)("handshake finished id=%d\n", it->second.handshake->getNetworkGameManagerId());
     338          }
     339
     340          PRINT(0)("handshake finished id=%d\n", it->second.handshake->getNetworkGameManagerId());
    344341
    345342          delete it->second.handshake;
    346343          it->second.handshake = NULL;
    347344         
     345          handleNewClient( it->second.userId );
    348346        }
    349347        else
    350348        {
    351           PRINTF(1)("handshake failed: %s!\n", it->second.handshake->getErrorString().c_str());
     349          PRINT(1)("handshake failed!\n");
    352350          it->second.socket->disconnectServer();
    353           it->second.socket = NULL;
    354          
    355           delete it->second.handshake;
    356           it->second.handshake = NULL;
    357351        }
    358352      }
     
    426420    }
    427421   
    428     NETPRINTF(0)("adsf\n");
    429    
    430422    assert( Converter::intToByteArray( offset, buf, INTSIZE ) == INTSIZE );
    431423   
    432     NETPRINTF(0)("adsf %d\n", offset);
    433    
    434424    assert( peer->second.socket->writePacket( buf, offset ) );
    435425   
    436     NETPRINTF(0)("adsf\n");
    437    
    438     //peer->second.connectionMonitor->processUnzippedOutgoingPacket( buf, offset, currentState );
     426    peer->second.connectionMonitor->processUnzippedOutgoingPacket( buf, offset, currentState );
    439427   
    440428    NETPRINTF(n)("send packet: %d userId = %d\n", offset, peer->second.userId);
     
    524512          if ( !peers[peer->second.userId].isServer )
    525513          {
    526             PRINTF(0)("Client %d is no server: dont accept new synchronizeable\n", peer->second.userId);
    527514            offset += syncDataLength;
    528515            continue;
     
    583570      }
    584571     
    585       //peer->second.connectionMonitor->processUnzippedIncomingPacket( buf, offset, currentState, ackedState );
     572      peer->second.connectionMonitor->processUnzippedIncomingPacket( buf, offset, currentState, ackedState );
    586573   
    587574      peer->second.lastAckedState = ackedState;
     
    610597void NetworkStream::cleanUpOldSyncList( )
    611598{
    612   //TODO dont return do something
    613   return;
    614599  int now = SDL_GetTicks();
    615600 
  • branches/network/src/lib/network/udp_socket.cc

    r7777 r7778  
    1717#include "udp_server_socket.h"
    1818
    19 #include "network_log.h"
    2019
    2120void UdpSocket::init( )
     
    152151bool UdpSocket::writePacket( byte * data, int length )
    153152{
    154   NETPRINTF(0)("adsf\n");
    155153  if ( serverSocket )
    156154  {
    157     NETPRINTF(0)("adsf\n");
    158155    NetworkPacket networkPacket;
    159156    networkPacket.length = length;
    160157    networkPacket.data = data;
    161     NETPRINTF(0)("adsf\n");
    162158    if ( !serverSocket->sendPacket( networkPacket, this->userId ) )
    163159    {
    164       NETPRINTF(0)("adsf\n");
    165160      bOk = false;
    166161      return false;
    167162    }
    168163    else
    169     {
    170       NETPRINTF(0)("adsf\n");
    171164      return true;
    172     }
    173     NETPRINTF(0)("adsf\n");
    174165  }
    175166  else
    176167  {
    177     if ( !socket )
    178       return false;
    179    
    180     NETPRINTF(0)("adsf\n");
    181168    assert( length <= packet->maxlen );
    182169   
    183     NETPRINTF(0)("adsf\n");
    184170    memcpy( packet->data, data, length );
    185     NETPRINTF(0)("adsf\n");
    186171    packet->len = length;
    187172   
    188     NETPRINTF(0)("adsf\n");
    189173    if ( SDLNet_UDP_Send( socket, 1, packet) == 0 )
    190174    {
    191       NETPRINTF(0)("adsf\n");
    192175      PRINTF(1)("SDLNet_UDP_Send: %s\n", SDLNet_GetError());
    193176      bOk = false;
     
    195178    }
    196179   
    197     NETPRINTF(0)("adsf\n");
    198180    return true;
    199181  }
    200   NETPRINTF(0)("adsf\n");
    201182}
    202183
Note: See TracChangeset for help on using the changeset viewer.