mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-03 11:54:30 -04:00
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:
parent
a76baa5421
commit
5e41b21cef
36 changed files with 632 additions and 224 deletions
|
@ -28,7 +28,7 @@
|
|||
#include "util/rsprint.h"
|
||||
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
#include "rsiface/rsnotify.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
/* Network setup States */
|
||||
|
||||
|
@ -586,7 +586,8 @@ void p3ConnectMgr::netUdpCheck()
|
|||
mStunMoreRequired = false; /* no point -> unreachable (EXT) */
|
||||
|
||||
/* send a system warning message */
|
||||
if (rsNotify)
|
||||
pqiNotify *notify = getPqiNotify();
|
||||
if (notify)
|
||||
{
|
||||
std::string title =
|
||||
"Warning: Bad Firewall Configuration";
|
||||
|
@ -603,8 +604,7 @@ void p3ConnectMgr::netUdpCheck()
|
|||
msg += " (2) enabling UPnP, or\n";
|
||||
msg += " (3) get a new (approved) Firewall/Router\n";
|
||||
|
||||
rsNotify->AddSysMessage(0, RS_SYS_WARNING,
|
||||
title, msg);
|
||||
notify->AddSysMessage(0, RS_SYS_WARNING, title, msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1051,13 +1051,15 @@ void p3ConnectMgr::tickMonitors()
|
|||
#endif
|
||||
|
||||
/* notify GUI */
|
||||
if ((peer.actions & RS_PEER_CONNECTED) &&
|
||||
(rsNotify))
|
||||
if (peer.actions & RS_PEER_CONNECTED)
|
||||
{
|
||||
rsNotify->AddPopupMessage(RS_POPUP_CONNECT,
|
||||
pqiNotify *notify = getPqiNotify();
|
||||
if (notify)
|
||||
{
|
||||
notify->AddPopupMessage(RS_POPUP_CONNECT,
|
||||
peer.id, "Peer Online: ");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/* do the Others as well! */
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
#define DHT_DEFAULT_WAITTIME 1 /* Std sleep break period */
|
||||
|
||||
#define DHT_NUM_BOOTSTRAP_BINS 2
|
||||
#define DHT_NUM_BOOTSTRAP_BINS 4
|
||||
#define DHT_MIN_BOOTSTRAP_REQ_PERIOD 30
|
||||
|
||||
void printDhtPeerEntry(dhtPeerEntry *ent, std::ostream &out);
|
||||
|
|
|
@ -29,6 +29,11 @@
|
|||
/* external reference point */
|
||||
RsNotify *rsNotify = NULL;
|
||||
|
||||
pqiNotify *getPqiNotify()
|
||||
{
|
||||
return ((p3Notify *) rsNotify);
|
||||
}
|
||||
|
||||
/* Output for retroshare-gui */
|
||||
bool p3Notify::NotifySysMessage(uint32_t &sysid, uint32_t &type,
|
||||
std::string &title, std::string &msg)
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
|
||||
#include "rsiface/rsnotify.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
#include "util/rsthreads.h"
|
||||
|
||||
|
@ -49,7 +50,8 @@ class p3NotifyPopupMsg
|
|||
std::string msg;
|
||||
};
|
||||
|
||||
class p3Notify: public RsNotify
|
||||
|
||||
class p3Notify: public RsNotify, public pqiNotify
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -68,10 +70,10 @@ virtual bool GetPopupMessageList(std::map<uint32_t, std::string> &list);
|
|||
virtual bool SetSysMessageMode(uint32_t sysid, uint32_t mode);
|
||||
virtual bool SetPopupMessageMode(uint32_t ptype, uint32_t mode);
|
||||
|
||||
/* Input from libretroshare */
|
||||
|
||||
/* Overloaded from pqiNotify */
|
||||
virtual bool AddPopupMessage(uint32_t ptype, std::string name, std::string msg);
|
||||
virtual bool AddSysMessage(uint32_t sysid, uint32_t type,
|
||||
std::string title, std::string msg);
|
||||
virtual bool AddSysMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -319,6 +319,9 @@ virtual int isactive() = 0;
|
|||
virtual bool moretoread() = 0;
|
||||
virtual bool cansend() = 0;
|
||||
|
||||
/* method for streamer to shutdown bininterface */
|
||||
virtual int close() = 0;
|
||||
|
||||
/* if hashing data */
|
||||
virtual std::string gethash() = 0;
|
||||
virtual uint64_t bytecount() { return 0; }
|
||||
|
|
|
@ -89,6 +89,16 @@ BinFileInterface::~BinFileInterface()
|
|||
fclose(buf);
|
||||
}
|
||||
}
|
||||
|
||||
int BinFileInterface::close()
|
||||
{
|
||||
if (buf)
|
||||
{
|
||||
fclose(buf);
|
||||
buf = NULL;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BinFileInterface::senddata(void *data, int len)
|
||||
{
|
||||
|
@ -179,6 +189,19 @@ BinMemInterface::~BinMemInterface()
|
|||
return;
|
||||
}
|
||||
|
||||
int BinMemInterface::close()
|
||||
{
|
||||
if (buf)
|
||||
{
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
}
|
||||
size = 0;
|
||||
recvsize = 0;
|
||||
readloc = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* some fns to mess with the memory */
|
||||
int BinMemInterface::fseek(int loc)
|
||||
{
|
||||
|
@ -514,6 +537,15 @@ bool NetBinDummy::cansend()
|
|||
return dummyConnected;
|
||||
}
|
||||
|
||||
int NetBinDummy::close()
|
||||
{
|
||||
std::cerr << "NetBinDummy::close() ";
|
||||
printNetBinID(std::cerr, PeerId(), type);
|
||||
std::cerr << std::endl;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string NetBinDummy::gethash()
|
||||
{
|
||||
std::cerr << "NetBinDummy::gethash() ";
|
||||
|
|
|
@ -55,7 +55,7 @@ virtual bool moretoread()
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual int close();
|
||||
virtual bool cansend() { return (bin_flags | BIN_FLAGS_WRITEABLE); }
|
||||
virtual bool bandwidthLimited() { return false; }
|
||||
|
||||
|
@ -106,6 +106,7 @@ virtual bool moretoread()
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual int close();
|
||||
virtual bool cansend() { return (bin_flags | BIN_FLAGS_WRITEABLE); }
|
||||
virtual bool bandwidthLimited() { return false; }
|
||||
|
||||
|
@ -146,6 +147,8 @@ virtual int netstatus();
|
|||
virtual int isactive();
|
||||
virtual bool moretoread();
|
||||
virtual bool cansend();
|
||||
virtual int close();
|
||||
|
||||
virtual std::string gethash();
|
||||
|
||||
private:
|
||||
|
|
|
@ -177,6 +177,12 @@ int pqissl::disconnect()
|
|||
return reset();
|
||||
}
|
||||
|
||||
/* BinInterface version of reset() for pqistreamer */
|
||||
int pqissl::close()
|
||||
{
|
||||
return reset();
|
||||
}
|
||||
|
||||
// put back on the listening queue.
|
||||
int pqissl::reset()
|
||||
{
|
||||
|
|
|
@ -116,6 +116,8 @@ virtual int netstatus();
|
|||
virtual int isactive();
|
||||
virtual bool moretoread();
|
||||
virtual bool cansend();
|
||||
|
||||
virtual int close(); /* BinInterface version of reset() */
|
||||
virtual std::string gethash(); /* not used here */
|
||||
virtual bool bandwidthLimited();
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include <sstream>
|
||||
#include "pqi/pqidebug.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
const int pqistreamerzone = 8221;
|
||||
|
||||
|
@ -520,7 +521,34 @@ int pqistreamer::handleincoming()
|
|||
if (extralen > maxlen - blen)
|
||||
{
|
||||
pqioutput(PQL_ALERT, pqistreamerzone, "ERROR: Read Packet too Big!");
|
||||
exit(1);
|
||||
|
||||
pqiNotify *notify = getPqiNotify();
|
||||
if (notify)
|
||||
{
|
||||
std::string title =
|
||||
"Warning: Bad Packet Read";
|
||||
|
||||
std::string msg;
|
||||
msg += " **** WARNING **** \n";
|
||||
msg += "Retroshare has caught a BAD Packet Read";
|
||||
msg += "\n";
|
||||
msg += "This is normally caused by connecting to an";
|
||||
msg += " OLD version of Retroshare";
|
||||
msg += "\n";
|
||||
msg += "\n";
|
||||
msg += "Please get your friends to upgrade to the latest version";
|
||||
msg += "\n";
|
||||
msg += "\n";
|
||||
msg += "If you are sure the error was not caused by an old version";
|
||||
msg += "\n";
|
||||
msg += "Please report the problem to Retroshare's developers";
|
||||
msg += "\n";
|
||||
notify->AddSysMessage(0, RS_SYS_WARNING, title, msg);
|
||||
}
|
||||
bio->close();
|
||||
return -1;
|
||||
|
||||
// Used to exit now! exit(1);
|
||||
}
|
||||
|
||||
if (extralen > 0)
|
||||
|
@ -534,10 +562,27 @@ int pqistreamer::handleincoming()
|
|||
out << tmplen << "/" << extralen << ")" << std::endl;
|
||||
pqioutput(PQL_ALERT, pqistreamerzone, out.str());
|
||||
|
||||
// temp to catch this....
|
||||
pqiNotify *notify = getPqiNotify();
|
||||
if (notify)
|
||||
{
|
||||
std::string title =
|
||||
"Warning: Error Completing Read";
|
||||
|
||||
std::string msg;
|
||||
msg += " **** WARNING **** \n";
|
||||
msg += "Retroshare has experienced an unexpected Read ERROR";
|
||||
msg += "\n";
|
||||
msg += "Please contact the developers.";
|
||||
msg += "\n";
|
||||
|
||||
notify->AddSysMessage(0, RS_SYS_WARNING, title, msg);
|
||||
}
|
||||
bio->close();
|
||||
return -1;
|
||||
|
||||
// if it is triggered ... need to modify code.
|
||||
// XXXX Bug to fix!
|
||||
exit(1);
|
||||
//exit(1);
|
||||
|
||||
// error....
|
||||
inReadBytes(readbytes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue