Lots of bugfixes and tweaks:

* Switched p3Ranking to share Friends Links as well as own.
 * Modified rankmsgs to contain source id.
 * Fixed up rsNotify, added pqiNotify and global function call to get it.
 * Added notify for Bad Incoming Directory
 * Added Emergency Incoming directory so RS can keep running.
 * Added notify for Bad Packet (connecting to V0.3.X)
 * Added notify for Incomplete Packet Read (not been triggered yet!)
 * added close() to BinInterface, close on pqissl calls reset() 
 * removed exit(1) calls from pqistreamer, replaced with bio->close().
 * Increased Maximum Packet Size for HTML messages.
 * Fixed Online/Offline Message Forwarding. (TEST).
 * Increased DHT bootstrap buckets to 4.
 * Cleaned up much of serialiser debug (was slowing down Mac)
 * Added directory path to File Listings.
 * added ConvertSharedFilePath() so correct local dir can be found.
 * Added ForceDirectoryCheck() and InDirectoryCheck() for file hashing.
 * removed old TMP cache loading.
 * switched off Cache debug.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@448 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-03-31 14:06:59 +00:00
parent a76baa5421
commit 5e41b21cef
36 changed files with 632 additions and 224 deletions

View file

@ -146,6 +146,13 @@ void filedexserver::setSaveDir(std::string d)
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
}
void filedexserver::setEmergencySaveDir(std::string s)
{
if (ftFiler)
{
ftFiler -> setEmergencyBasePath(s);
}
}
bool filedexserver::getSaveIncSearch()
{
@ -198,6 +205,29 @@ int filedexserver::reScanDirs()
return 1;
}
bool filedexserver::ConvertSharedFilePath(std::string path, std::string &fullpath)
{
if (fimon)
return fimon->convertSharedFilePath(path, fullpath);
return false;
}
void filedexserver::ForceDirectoryCheck()
{
if (fimon)
fimon->forceDirectoryCheck();
return;
}
bool filedexserver::InDirectoryCheck()
{
if (fimon)
return fimon->inDirectoryCheck();
return false;
}
/*************************************** NEW File Cache Stuff ****************************/
void filedexserver::initialiseFileStore()
@ -234,41 +264,6 @@ void filedexserver::setFileCallback(std::string ownId, CacheStrapper *strappe
CachePair cp(fimon, fiStore, CacheId(RS_SERVICE_TYPE_FILE_INDEX, 0));
mCacheStrapper -> addCachePair(cp);
#if 0
/************ TMP HACK LOAD until new serialiser is finished */
/* get filename and hash from configuration */
std::string localCacheFile; // = getSSLRoot()->getSetting(LOCAL_CACHE_FILE_KEY);
std::string localCacheHash; // = getSSLRoot()->getSetting(LOCAL_CACHE_HASH_KEY);
std::string localCacheSize; // = getSSLRoot()->getSetting(LOCAL_CACHE_SIZE_KEY);
std::list<std::string> saveLocalCaches;
std::list<std::string> saveRemoteCaches;
if ((localCacheFile != "") &&
(localCacheHash != "") &&
(localCacheSize != ""))
{
/* load it up! */
std::string loadCacheFile = localcachedir + "/" + localCacheFile;
CacheData cd;
cd.pid = ownId;
cd.cid = CacheId(RS_SERVICE_TYPE_FILE_INDEX, 0);
cd.name = localCacheFile;
cd.path = localcachedir;
cd.hash = localCacheHash;
cd.size = atoi(localCacheSize.c_str());
fimon -> loadLocalCache(cd);
saveLocalCaches.push_back(cd.name);
}
/* cleanup cache directories */
RsDirUtil::cleanupDirectory(localcachedir, saveLocalCaches);
RsDirUtil::cleanupDirectory(remotecachedir, saveRemoteCaches); /* clean up all */
/************ TMP HACK LOAD until new serialiser is finished */
#endif
return;
}

View file

@ -77,8 +77,13 @@ int getFile(std::string fname, std::string hash,
void clear_old_transfers();
void cancelTransfer(std::string fname, std::string hash, uint32_t size);
// access to search info is also required.
bool ConvertSharedFilePath(std::string path, std::string &fullpath);
void ForceDirectoryCheck();
bool InDirectoryCheck();
std::list<std::string> &getSearchDirectories();
int addSearchDirectory(std::string dir);
int removeSearchDirectory(std::string dir);
@ -87,6 +92,8 @@ int check_dBUpdate();
std::string getSaveDir();
void setSaveDir(std::string d);
void setEmergencySaveDir(std::string s);
void setConfigDir(std::string d) { config_dir = d; }
bool getSaveIncSearch();
void setSaveIncSearch(bool v);

View file

@ -119,6 +119,7 @@ virtual std::list<RsFileTransfer *> getStatus() = 0;
public:
virtual void setSaveBasePath(std::string s) = 0;
virtual void setEmergencyBasePath(std::string s) = 0;
virtual int recvFileInfo(ftFileRequest *in) = 0;
virtual ftFileRequest * sendFileInfo() = 0;

View file

@ -30,6 +30,7 @@
#include "util/rsdir.h"
#include "pqi/pqidebug.h"
#include "pqi/pqinotify.h"
#include <errno.h>
#include <sstream>
@ -1111,10 +1112,77 @@ int ftfiler::initiateFileTransfer(ftFileStatus *s)
partialpath += PARTIAL_DIR;
if (!RsDirUtil::checkCreateDirectory(partialpath))
{
std::ostringstream out;
out << "ftfiler::initiateFileTransfer() Cannot create partial directory: " << partialpath;
pqioutput(PQL_ALERT, ftfilerzone, out.str());
exit(1);
{
std::ostringstream out;
out << "ftfiler::initiateFileTransfer() Cannot create partial directory: " << partialpath;
pqioutput(PQL_ALERT, ftfilerzone, out.str());
}
std::string tmppath = mEmergencyIncomingDir;
if (!RsDirUtil::checkCreateDirectory(tmppath))
{
std::ostringstream out;
out << "ftfiler::initiateFileTransfer() Cannot create EmergencyIncomingDir: ";
out << tmppath;
pqioutput(PQL_ALERT, ftfilerzone, out.str());
exit(1);
}
/* Store new temp path */
saveBasePath = tmppath;
tmppath += "/";
tmppath += PARTIAL_DIR;
if (!RsDirUtil::checkCreateDirectory(tmppath))
{
std::ostringstream out;
out << "ftfiler::initiateFileTransfer() Cannot create EmergencyIncomingPartialsDir: ";
out << tmppath;
pqioutput(PQL_ALERT, ftfilerzone, out.str());
exit(1);
}
{
std::ostringstream out;
out << "ftfiler::initiateFileTransfer() Using Emergency Download Directory: " << saveBasePath;
pqioutput(PQL_ALERT, ftfilerzone, out.str());
}
pqiNotify *notify = getPqiNotify();
if (notify)
{
std::string title =
"Warning: Bad Incoming Directory";
std::string msg;
msg += " **** WARNING **** \n";
msg += "Retroshare cannot create Incoming Partials Directory: ";
msg += "\n";
msg += partialpath;
msg += "\n";
msg += "\n";
msg += "This is needed for normal operation.";
msg += "\n";
msg += "\n";
msg += "The incoming directory has been temporarily changed to:";
msg += "\n";
msg += saveBasePath;
msg += "\n";
msg += "\n";
msg += "Please select a new Downloads Directory ASAP Using:";
msg += "\n";
msg += "SideBar->Options->Directories";
msg += "\n";
notify->AddSysMessage(0, RS_SYS_WARNING, title, msg);
}
else
{
std::cerr << "ftfiler::initiateFileTransfer() Notify not exist!";
std::cerr << std::endl;
exit(1);
}
}
/* check if the file exists */
@ -1437,6 +1505,13 @@ void ftfiler::setSaveBasePath(std::string s)
}
void ftfiler::setEmergencyBasePath(std::string s)
{
mEmergencyIncomingDir = s;
return;
}
/***********************
* Notes

View file

@ -172,6 +172,7 @@ int tick();
std::list<RsFileTransfer *> getStatus();
virtual void setSaveBasePath(std::string s);
virtual void setEmergencyBasePath(std::string s);
/************* Network Interface****************************/
virtual int recvFileInfo(ftFileRequest *in);
@ -224,6 +225,7 @@ private:
std::list<ftFileRequest *> out_queue;
std::string saveBasePath;
std::string mEmergencyIncomingDir;
};