* Enabled saving of data rate limits.

* Fixed Lost certificates issue(!)
 * Tweaked Tick rate parameters.
 * Added new chatAvailable interface fn.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@469 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-04-04 12:19:50 +00:00
parent a8386b454c
commit 12d3606ad4
9 changed files with 64 additions and 10 deletions

View File

@ -633,16 +633,34 @@ bool AuthXPGP::SignCertificate(std::string id)
if (locked_FindCert(id, &cert))
{
XPGP_sign_certificate(pgp_keyring, cert->certificate, own->certificate);
if (0 < validateCertificateIsSignedByKey(
cert->certificate, own->certificate))
{
#ifdef AUTHXPGP_DEBUG
std::cerr << "AuthXPGP::SignCertificate() Signed Already: " << id;
std::cerr << std::endl;
#endif
cert->ownsign=true;
}
else
{
#ifdef AUTHXPGP_DEBUG
std::cerr << "AuthXPGP::SignCertificate() Signing Cert: " << id;
std::cerr << std::endl;
#endif
/* sign certificate */
XPGP_sign_certificate(pgp_keyring, cert->certificate, own->certificate);
/* reevaluate the auth of the xpgp */
cert->trustLvl = XPGP_auth_certificate(pgp_keyring, cert->certificate);
cert->ownsign = true;
/* reevaluate the auth of the xpgp */
cert->trustLvl = XPGP_auth_certificate(pgp_keyring, cert->certificate);
cert->ownsign = true;
mToSaveCerts = true;
}
valid = true;
mToSaveCerts = true;
}
xpgpMtx.unlock(); /**** UNLOCK ****/
return valid;
}
@ -751,6 +769,8 @@ bool AuthXPGP::AuthCertificate(std::string id)
/* reevaluate the auth of the xpgp */
cert->trustLvl = XPGP_auth_certificate(pgp_keyring, cert->certificate);
cert->ownsign = true;
mToSaveCerts = true;
}
valid = true;
}
@ -2083,13 +2103,15 @@ bool AuthXPGP::loadCertificates(bool &oldFormat, std::map<std::string, std::s
{
keyValueMap[mit -> first] = mit -> second;
}
mToSaveCerts = false;
if (keyValueMap.size() > 0)
{
oldFormat = true;
mToSaveCerts = true;
}
mToSaveCerts = false;
return true;
}

View File

@ -811,7 +811,7 @@ bool p3ConnectMgr::stunCheck()
bool stunOk = false;
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::stunCheck()" << std::endl;
//std::cerr << "p3ConnectMgr::stunCheck()" << std::endl;
#endif
{

View File

@ -26,6 +26,10 @@
#include "pqi/pqi.h"
#include "pqi/pqiloopback.h"
/***
#define LOOPBACK_DEBUG 1
***/
pqiloopback::pqiloopback(std::string id)
:PQInterface(id)
{
@ -44,6 +48,13 @@ pqiloopback::~pqiloopback()
int pqiloopback::SendItem(RsItem *i)
{
#ifdef LOOPBACK_DEBUG
std::cerr << "pqiloopback::SendItem()";
std::cerr << std::endl;
i->print(std::cerr);
std::cerr << std::endl;
#endif
objs.push_back(i);
return 1;
}
@ -54,6 +65,12 @@ RsItem * pqiloopback::GetItem()
{
RsItem *pqi = objs.front();
objs.pop_front();
#ifdef LOOPBACK_DEBUG
std::cerr << "pqiloopback::GetItem()";
std::cerr << std::endl;
pqi->print(std::cerr);
std::cerr << std::endl;
#endif
return pqi;
}
return NULL;

View File

@ -127,6 +127,7 @@ virtual bool MessageRead(std::string mid) = 0;
/****************************************/
/* Chat */
virtual bool chatAvailable() = 0;
virtual bool ChatSend(ChatInfo &ci) = 0;
virtual bool getNewChat(std::list<ChatInfo> &chats) = 0;

View File

@ -254,6 +254,8 @@ int RsServer::ConfigSetDataRates( int total, int indiv ) /* in kbrates */
pqih -> setMaxIndivRate(true, indiv);
pqih -> setMaxIndivRate(false, indiv);
pqih -> save_config();
/* unlock Mutexes */
iface.unlockData(); /* UNLOCK */
unlockRsCore(); /* UNLOCK */

View File

@ -78,8 +78,8 @@ void RsServer::run()
double timeDelta = 0.25;
double minTimeDelta = 0.1; // 25;
double maxTimeDelta = 1.0;
double kickLimit = 0.5;
double maxTimeDelta = 0.5;
double kickLimit = 0.15;
double avgTickRate = timeDelta;

View File

@ -106,6 +106,11 @@ bool p3Msgs::ChatSend(ChatInfo &ci)
return true;
}
bool p3Msgs::chatAvailable()
{
return mChatSrv->receivedItems();
}
bool p3Msgs::getNewChat(std::list<ChatInfo> &chats)
{
/* get any messages and push them to iface */

View File

@ -52,6 +52,7 @@ virtual bool MessageRead(std::string mid);
/****************************************/
/* Chat */
virtual bool chatAvailable();
virtual bool ChatSend(ChatInfo &ci);
virtual bool getNewChat(std::list<ChatInfo> &chats);

View File

@ -140,6 +140,12 @@ std::list<RsChatItem *> p3ChatService::getChatQueue()
while(NULL != (ci = (RsChatItem *) recvItem()))
{
#ifdef CHAT_DEBUG
std::cerr << "p3ChatService::getChatQueue() Item:";
std::cerr << std::endl;
ci->print(std::cerr);
std::cerr << std::endl;
#endif
ci->recvTime = now;
ilist.push_back(ci);
}