Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6060 in orxonox.OLD for branches/network/src/lib


Ignore:
Timestamp:
Dec 12, 2005, 1:42:57 PM (19 years ago)
Author:
bwuest
Message:

Network changes

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

Legend:

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

    r6043 r6060  
    115115  h.version = data[1];
    116116  /* unique ID */
    117   h.uniqueID = data[2];
     117  h.synchronizeableID = data[2];
    118118  /* data length*/
    119119  h.length = data[3];
  • branches/network/src/lib/network/network_protocol.h

    r6043 r6060  
    1717  byte protocol;
    1818  byte version;
    19   byte uniqueID;
     19  byte synchronizeableID;
    2020  byte length;
    2121};
  • branches/network/src/lib/network/network_stream.cc

    r6059 r6060  
    127127}
    128128
     129void NetworkStream::disconnectSynchronizeable(Synchronizeable& sync)
     130{
     131  this->synchronizeables.remove(&sync);
     132
     133  if( this->networkSockets.size()<=0 )
     134    this->bActive = false;
     135}
     136
    129137
    130138void NetworkStream::processData()
     
    241249        for (SynchronizeableList::iterator it = synchronizeables.begin(); it!=synchronizeables.end(); it++)
    242250        {
    243           if ( *it && (*it)->getUniqueID()==header.uniqueID )
     251          if ( *it && (*it)->getUniqueID()==header.synchronizeableID )
    244252            (*it)->writeBytes(upBuffer+sizeof(header), dataLength);
    245253        }
  • branches/network/src/lib/network/network_stream.h

    r6043 r6060  
    3838
    3939    void connectSynchronizeable(Synchronizeable& sync);
     40    void disconnectSynchronizeable(Synchronizeable& sync);
    4041
    4142    inline bool isServer() const { return (this->type == NET_SERVER)? true:false; }
  • branches/network/src/lib/network/synchronizeable.cc

    r6053 r6060  
    2020#include "netdefs.h"
    2121#include "network_manager.h"
     22#include "network_stream.h"
    2223
    2324
     
    2829{
    2930
    30   //owner = ?;
     31  owner = 0;
    3132  hostID = NetworkManager::getInstance()->getHostID();
    3233  //state = ?;
     
    4748 */
    4849Synchronizeable::~Synchronizeable()
    49 {}
     50{
     51  if ( this->networkStream )
     52    this->networkStream->disconnectSynchronizeable(*this);
     53}
    5054
    5155/**
  • branches/network/src/lib/network/synchronizeable.h

    r6053 r6060  
    1818#define STATE_SERVER 1
    1919#define STATE_OUTOFSYNC 2
     20
     21class NetworkStream;
    2022
    2123
     
    4345    inline int getOwner(){ return owner; }
    4446    inline void setOwner(int owner){ this->owner = owner; }
     47   
     48    inline void setNetworkStream(NetworkStream* stream) { this->networkStream = stream; }
    4549
    4650  private:
     
    5559    int state;
    5660    std::list<int> synchronizeRequests;
     61   
     62    NetworkStream* networkStream;
    5763
    5864  };
Note: See TracChangeset for help on using the changeset viewer.