Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8496 in orxonox.OLD


Ignore:
Timestamp:
Jun 15, 2006, 10:11:56 PM (18 years ago)
Author:
rennerc
Message:

NetworkStream should use different dicts for server/client now

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

Legend:

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

    r8494 r8496  
    9595  remainingBytesToWriteToDict = Preferences::getInstance()->getInt( "compression", "writedict", 0 );
    9696 
    97   assert( Zip::getInstance()->loadDictionary( "testdict" ) );
     97  assert( Zip::getInstance()->loadDictionary( "testdict" ) >= 0 );
     98  this->dictClient = Zip::getInstance()->loadDictionary( "dict2pl_client" );
     99  assert( this->dictClient >= 0 );
     100  this->dictServer = Zip::getInstance()->loadDictionary( "dict2pl_server" );
     101  assert( this->dictServer >= 0 );
    98102}
    99103
     
    504508    assert( Converter::intToByteArray( offset, buf, INTSIZE ) == INTSIZE );
    505509   
    506     int compLength = Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE );
     510    int compLength = 0;
     511    if ( this->isServer() )
     512      Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictServer );
     513    else
     514      Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictClient );
    507515   
    508516    if ( compLength < 0 )
  • branches/network/src/lib/network/network_stream.h

    r8494 r8496  
    107107
    108108    int                        remainingBytesToWriteToDict; //!< if > 0 NetworkStream will write packets to DATA/dicts/newdict
     109
     110    int dictServer;
     111    int dictClient;
    109112};
    110113#endif /* _NETWORK_STREAM */
  • branches/network/src/lib/network/zip.cc

    r7954 r8496  
    4848 * @return true on success
    4949 */
    50 bool Zip::loadDictionary( std::string name )
     50int Zip::loadDictionary( std::string name )
    5151{
    5252  std::string fileName = ResourceManager::getInstance()->getDataDir();
     
    6060  {
    6161    PRINTF(1)("Could not open %d\n", fileName.c_str());
    62     return false;
     62    return -1;
    6363  }
    6464 
     
    8787  PRINTF(3)("Loaded dictionary '%s' with adler = %d\n", name.c_str(), entry.adler );
    8888 
    89   return true;
     89  return dicts.size()-1;
    9090}
    9191
  • branches/network/src/lib/network/zip.h

    r7954 r8496  
    2828    inline static Zip* getInstance(void) { if (!singletonRef) singletonRef = new Zip();  return singletonRef; };
    2929   
    30     bool loadDictionary( std::string name );
     30    int loadDictionary( std::string name );
    3131    int zip( byte * from, int fromLength, byte * to, int maxLength, int dict = 0 );
    3232    int unZip( byte * from, int fromLength, byte * to, int maxLength );
Note: See TracChangeset for help on using the changeset viewer.