fixed bug with anonymous channels asking for friends to be sources

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4632 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-10-06 20:06:25 +00:00
parent 6addc80e99
commit 2173ee0d2e
2 changed files with 19 additions and 18 deletions

View File

@ -1176,7 +1176,7 @@ bool ftController::FileRequest(const std::string& fname, const std::string& has
/* do a source search - for any extra sources */
// add sources only in direct mode
//
if ((!(flags & RS_FILE_HINTS_NETWORK_WIDE)) && mSearch->search(hash, RS_FILE_HINTS_REMOTE | RS_FILE_HINTS_SPEC_ONLY, info))
if((flags & RS_FILE_HINTS_BROWSABLE) && mSearch->search(hash, RS_FILE_HINTS_REMOTE | RS_FILE_HINTS_SPEC_ONLY, info))
{
/* do something with results */
#ifdef CONTROL_DEBUG

View File

@ -827,8 +827,7 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, con
/* Iterate through files */
std::list<RsTlvFileItem>::iterator fit;
for(fit = chanMsg->attachment.items.begin();
fit != chanMsg->attachment.items.end(); fit++)
for(fit = chanMsg->attachment.items.begin(); fit != chanMsg->attachment.items.end(); fit++)
{
std::string fname = fit->name;
std::string hash = fit->hash;
@ -839,20 +838,23 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, con
uint32_t flags;
// send to download directory if file is private
if(chanPrivate){
localpath = mChannelsDir;
flags = RS_FILE_HINTS_BACKGROUND | RS_FILE_HINTS_EXTRA;
}else{
localpath = ""; // forces dl to default directory
flags = RS_FILE_HINTS_BACKGROUND |
RS_FILE_HINTS_NETWORK_WIDE;
}
// We also add explicit sources only if the channel is private. Otherwise we DL in network wide mode
// using anonymous tunnels.
//
std::list<std::string> srcIds;
srcIds.push_back(id);
if(chanPrivate)
{
localpath = mChannelsDir;
flags = RS_FILE_HINTS_BACKGROUND | RS_FILE_HINTS_EXTRA;
srcIds.push_back(id);
}
else
{
localpath = ""; // forces dl to default directory
flags = RS_FILE_HINTS_BACKGROUND | RS_FILE_HINTS_NETWORK_WIDE;
}
/* download it ... and flag for ExtraList
* don't do pre-search check as FileRequest does it better
@ -866,8 +868,7 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, con
#endif
if(size < MAX_AUTO_DL)
mRsFiles->FileRequest(fname, hash, size,
localpath, flags, srcIds);
mRsFiles->FileRequest(fname, hash, size, localpath, flags, srcIds);
}
if(lit != mReadStatus.end()){