peer update
git-svn-id: svn://db.shs.com.ru/pip@28 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -51,7 +51,7 @@ public:
|
||||
friend PIByteArray & operator <<(PIByteArray & s, const PIPeer::PeerInfo & v);
|
||||
friend PIByteArray & operator >>(PIByteArray & s, PIPeer::PeerInfo & v);
|
||||
public:
|
||||
PeerInfo() {dist = sync = cnt = 0; _neth = 0; _first = 0; was_update = false;}
|
||||
PeerInfo() {dist = sync = cnt = 0; trace = -1; was_update = false;}
|
||||
|
||||
struct Address {
|
||||
Address(const PIString & a = PIString(), const PIString & m = "255.255.255.0");
|
||||
@@ -76,16 +76,14 @@ public:
|
||||
void addNeighbour(const PIString & n) {if (!neighbours.contains(n)) neighbours << n;}
|
||||
void addNeighbours(const PIStringList & l) {piForeachC (PIString & n, l) if (!neighbours.contains(n)) neighbours << n;}
|
||||
void removeNeighbour(const PIString & n) {neighbours.removeAll(n);}
|
||||
void resetPing() {for (int i = 0; i < addresses.size_s(); ++i) addresses[i].ping = -1;}
|
||||
|
||||
|
||||
PIString nearest_address;
|
||||
PIStringList neighbours;
|
||||
int sync, cnt;
|
||||
int sync, cnt, trace;
|
||||
bool was_update;
|
||||
PISystemTime time;
|
||||
PIString _naddress;
|
||||
PIEthernet * _neth;
|
||||
PIVector<uchar> _nuses;
|
||||
PeerInfo * _first;
|
||||
PeerData _data;
|
||||
|
||||
};
|
||||
@@ -119,8 +117,8 @@ public:
|
||||
const PeerInfo & selfInfo() const {return self_info;}
|
||||
const PIMap<PIString, PIVector<PeerInfo * > > & _peerMap() const {return addresses_map;}
|
||||
|
||||
void lock() {mc_mutex.lock(); eth_mutex.lock(); peers_mutex.lock();}
|
||||
void unlock() {mc_mutex.unlock(); eth_mutex.unlock(); peers_mutex.unlock();}
|
||||
void lock() {mc_mutex.lock(); peers_mutex.lock();}
|
||||
void unlock() {mc_mutex.unlock(); peers_mutex.unlock();}
|
||||
|
||||
EVENT2(dataReceivedEvent, const PIString &, from, const PIByteArray &, data);
|
||||
EVENT1(peerConnectedEvent, const PIString &, name);
|
||||
|
||||
Reference in New Issue
Block a user