Clean up dead stuff from OneService and fix build errors.
This commit is contained in:
parent
900ec143a8
commit
5cfbb0a423
25 changed files with 45 additions and 9785 deletions
|
@ -545,78 +545,6 @@ public:
|
|||
return _localMultipathSupported && _remoteMultipathSupported && _remotePeerMultipathEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize a peer for storage in local cache
|
||||
*
|
||||
* This does not serialize everything, just non-ephemeral information.
|
||||
*/
|
||||
template<unsigned int C>
|
||||
inline void serializeForCache(Buffer<C> &b) const
|
||||
{
|
||||
b.append((uint8_t)1);
|
||||
|
||||
_id.serialize(b);
|
||||
|
||||
b.append((uint16_t)_vProto);
|
||||
b.append((uint16_t)_vMajor);
|
||||
b.append((uint16_t)_vMinor);
|
||||
b.append((uint16_t)_vRevision);
|
||||
|
||||
{
|
||||
Mutex::Lock _l(_paths_m);
|
||||
unsigned int pc = 0;
|
||||
for(unsigned int i=0;i<ZT_MAX_PEER_NETWORK_PATHS;++i) {
|
||||
if (_paths[i].p)
|
||||
++pc;
|
||||
else break;
|
||||
}
|
||||
b.append((uint16_t)pc);
|
||||
for(unsigned int i=0;i<pc;++i)
|
||||
_paths[i].p->address().serialize(b);
|
||||
}
|
||||
}
|
||||
|
||||
template<unsigned int C>
|
||||
inline static SharedPtr<Peer> deserializeFromCache(int64_t now,void *tPtr,Buffer<C> &b,const RuntimeEnvironment *renv)
|
||||
{
|
||||
try {
|
||||
unsigned int ptr = 0;
|
||||
if (b[ptr++] != 1)
|
||||
return SharedPtr<Peer>();
|
||||
|
||||
Identity id;
|
||||
ptr += id.deserialize(b,ptr);
|
||||
if (!id)
|
||||
return SharedPtr<Peer>();
|
||||
|
||||
SharedPtr<Peer> p(new Peer(renv,renv->identity,id));
|
||||
|
||||
p->_vProto = b.template at<uint16_t>(ptr); ptr += 2;
|
||||
p->_vMajor = b.template at<uint16_t>(ptr); ptr += 2;
|
||||
p->_vMinor = b.template at<uint16_t>(ptr); ptr += 2;
|
||||
p->_vRevision = b.template at<uint16_t>(ptr); ptr += 2;
|
||||
|
||||
// When we deserialize from the cache we don't actually restore paths. We
|
||||
// just try them and then re-learn them if they happen to still be up.
|
||||
// Paths are fairly ephemeral in the real world in most cases.
|
||||
const unsigned int tryPathCount = b.template at<uint16_t>(ptr); ptr += 2;
|
||||
for(unsigned int i=0;i<tryPathCount;++i) {
|
||||
InetAddress inaddr;
|
||||
try {
|
||||
ptr += inaddr.deserialize(b,ptr);
|
||||
if (inaddr)
|
||||
p->attemptToContactAt(tPtr,-1,inaddr,now,true);
|
||||
} catch ( ... ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return p;
|
||||
} catch ( ... ) {
|
||||
return SharedPtr<Peer>();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
struct _PeerPath
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue