Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 19, 2006, 10:29:14 PM (19 years ago)
Author:
patrick
Message:

work of the day in one commit:D

  • switched whole network framework to ip sturcture
  • extended ip structrue a little bit
  • reimplemented the disconnection/reconnection algorithm
  • synchronizeable ip bug discovered and solved
Location:
branches/proxy/src/lib/network/synchronizeable_var
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_ip.cc

    r9308 r9334  
    1616#include "synchronizeable_ip.h"
    1717#include "converter.h"
    18 
     18// #include "ip.h"
    1919
    2020/**
     
    2222 * @todo this constructor is not jet implemented - do it
    2323*/
    24 SynchronizeableIP::SynchronizeableIP( IPaddress * ptrIn, IPaddress * ptrOut, std::string name, int permission, int priority) : SynchronizeableVar( ptrIn, ptrOut, name, 2*INTSIZE, permission, priority )
     24SynchronizeableIP::SynchronizeableIP( IP * ptrIn, IP * ptrOut, std::string name, int permission, int priority) : SynchronizeableVar( ptrIn, ptrOut, name, 2*INTSIZE, permission, priority )
    2525{
    2626  this->vPtrIn = ptrIn;
     
    4747  int res;
    4848
    49   res = Converter::intToByteArray( (int)vPtrIn->host, buf, maxLength );
     49  res = Converter::intToByteArray( (int)vPtrIn->ip(), buf, maxLength );
    5050  assert(res > 0);
    5151  n += res;
    5252
    53   res = Converter::intToByteArray( (int)vPtrIn->port, buf, maxLength);
     53  res = Converter::intToByteArray( (int)vPtrIn->port(), buf, maxLength);
    5454  assert(res > 0);
    5555  n += res;
     
    7575  int n = 0;
    7676
    77   IPaddress oldIP = *vPtrOut;
    78   IPaddress newIP;
     77  IP oldIP = *vPtrOut;
    7978
    8079  res = Converter::byteArrayToInt( buf + n, &host);
     
    8786  n += res;
    8887
    89   newIP.host = host;
    90   newIP.port = port;
     88  *this->vPtrOut = IP(host, port);
    9189
    92   setHasChanged( (newIP.host != oldIP.host || newIP.port != oldIP.port) );
     90  setHasChanged( *this->vPtrOut != oldIP);
    9391
    9492  assert( n == 2 * INTSIZE);
     
    103101void SynchronizeableIP::SynchronizeableIP::debug( )
    104102{
    105   printf("SYNCHRONIZEABLE_VAR: %s IN: %i, %i OUT: %i, %i\n", name.c_str(), vPtrIn->host, vPtrIn->port, vPtrOut->host, vPtrOut->port);
     103  printf("SYNCHRONIZEABLE_VAR: %s IN: %i, %i OUT: %i, %i\n", name.c_str(), vPtrIn->ip(), vPtrIn->port(), vPtrOut->ip(), vPtrOut->port());
    106104}
    107105
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_ip.h

    r9293 r9334  
    1212
    1313#include "netdefs.h"
     14#include "ip.h"
    1415
    1516class SynchronizeableIP : public SynchronizeableVar {
    1617
    1718  public:
    18     SynchronizeableIP( IPaddress *ptrIn, IPaddress * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
     19    SynchronizeableIP( IP *ptrIn, IP * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
    1920    virtual ~SynchronizeableIP();
    2021
     
    3233
    3334  private:
    34     IPaddress * vPtrIn;       //!< pointer to data (read)
    35     IPaddress * vPtrOut;      //!< pointer to data (write)
     35    IP * vPtrIn;       //!< pointer to data (read)
     36    IP * vPtrOut;      //!< pointer to data (write)
    3637
    3738};
Note: See TracChangeset for help on using the changeset viewer.