mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
- implemented bidirectional exchange of chunk maps for direct downloads, to allow showing proper completion of transfers from direct friends.
- moved the direction flag upward in the pipeline (ftDataSend instead of p3turtle) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3313 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
569ac25843
commit
cee8600a93
13 changed files with 483 additions and 71 deletions
|
@ -1202,7 +1202,7 @@ void p3turtle::sendFileData(const std::string& peerId, const std::string& hash,
|
|||
sendItem(item) ;
|
||||
}
|
||||
|
||||
void p3turtle::sendChunkMapRequest(const std::string& peerId,const std::string& hash)
|
||||
void p3turtle::sendChunkMapRequest(const std::string& peerId,const std::string& hash,bool is_client)
|
||||
{
|
||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
|
@ -1229,16 +1229,18 @@ void p3turtle::sendChunkMapRequest(const std::string& peerId,const std::string&
|
|||
|
||||
if(tunnel.local_src == ownid)
|
||||
{
|
||||
assert(!is_client) ;
|
||||
item->direction = RsTurtleGenericTunnelItem::DIRECTION_SERVER ;
|
||||
item->PeerId(tunnel.local_dst) ;
|
||||
}
|
||||
else if(tunnel.local_dst == ownid)
|
||||
{
|
||||
assert(is_client) ;
|
||||
item->direction = RsTurtleGenericTunnelItem::DIRECTION_CLIENT ;
|
||||
item->PeerId(tunnel.local_src) ;
|
||||
}
|
||||
else
|
||||
std::cerr << "p3turtle::sendChunkMap: consistency error!" << std::endl ;
|
||||
std::cerr << "p3turtle::sendChunkMapRequest: consistency error!" << std::endl ;
|
||||
|
||||
#ifdef P3TURTLE_DEBUG
|
||||
std::cerr << "p3turtle: sending chunk map req to peer " << peerId << ", hash=0x" << hash << ") through tunnel " << (void*)item->tunnel_id << ", next peer=" << item->PeerId() << std::endl ;
|
||||
|
@ -1246,7 +1248,7 @@ void p3turtle::sendChunkMapRequest(const std::string& peerId,const std::string&
|
|||
sendItem(item) ;
|
||||
}
|
||||
|
||||
void p3turtle::sendChunkMap(const std::string& peerId,const std::string& hash,const CompressedChunkMap& cmap)
|
||||
void p3turtle::sendChunkMap(const std::string& peerId,const std::string& hash,const CompressedChunkMap& cmap,bool is_client)
|
||||
{
|
||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
|
@ -1274,11 +1276,13 @@ void p3turtle::sendChunkMap(const std::string& peerId,const std::string& hash,co
|
|||
|
||||
if(tunnel.local_src == ownid)
|
||||
{
|
||||
assert(!is_client) ;
|
||||
item->direction = RsTurtleGenericTunnelItem::DIRECTION_SERVER ;
|
||||
item->PeerId(tunnel.local_dst) ;
|
||||
}
|
||||
else if(tunnel.local_dst == ownid)
|
||||
{
|
||||
assert(is_client) ;
|
||||
item->direction = RsTurtleGenericTunnelItem::DIRECTION_CLIENT ;
|
||||
item->PeerId(tunnel.local_src) ;
|
||||
}
|
||||
|
|
|
@ -284,10 +284,10 @@ class p3turtle: public p3Service, public pqiMonitor, public RsTurtle,/* public f
|
|||
void sendFileData(const std::string& peerId, const std::string& hash, uint64_t size, uint64_t baseoffset, uint32_t chunksize, void *data) ;
|
||||
|
||||
/// Send a request for the chunk map of this file to the given peer
|
||||
void sendChunkMapRequest(const std::string& peerId, const std::string& hash) ;
|
||||
void sendChunkMapRequest(const std::string& peerId, const std::string& hash,bool is_client) ;
|
||||
|
||||
/// Send a chunk map of this file to the given peer
|
||||
void sendChunkMap(const std::string& peerId, const std::string& hash,const CompressedChunkMap& cmap) ;
|
||||
void sendChunkMap(const std::string& peerId, const std::string& hash,const CompressedChunkMap& cmap,bool is_client) ;
|
||||
|
||||
/// Send a request for the crc32 map of this file to the given peer
|
||||
void sendCRC32MapRequest(const std::string& peerId, const std::string& hash) ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue