mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
i2p: bob: removed function name within debug output (replaced by __PRETTY_FUNCTION__)
This commit is contained in:
parent
a41e10b178
commit
1da3d262d9
@ -160,7 +160,7 @@ void p3I2pBob::processTaskAsync(taskTicket *ticket)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " p3I2pBob::processTaskAsync unknown task" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " unknown task" << std::endl;
|
||||||
rsAutoProxyMonitor::taskError(ticket);
|
rsAutoProxyMonitor::taskError(ticket);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -175,7 +175,7 @@ void p3I2pBob::processTaskSync(taskTicket *ticket)
|
|||||||
case autoProxyTask::status:
|
case autoProxyTask::status:
|
||||||
// check if everything needed is set
|
// check if everything needed is set
|
||||||
if (!data) {
|
if (!data) {
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " p3I2pBob::status autoProxyTask::status data is missing" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " autoProxyTask::status data is missing" << std::endl;
|
||||||
rsAutoProxyMonitor::taskError(ticket);
|
rsAutoProxyMonitor::taskError(ticket);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -189,7 +189,7 @@ void p3I2pBob::processTaskSync(taskTicket *ticket)
|
|||||||
case autoProxyTask::getSettings:
|
case autoProxyTask::getSettings:
|
||||||
// check if everything needed is set
|
// check if everything needed is set
|
||||||
if (!data) {
|
if (!data) {
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " p3I2pBob::data_tick autoProxyTask::getSettings data is missing" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " autoProxyTask::getSettings data is missing" << std::endl;
|
||||||
rsAutoProxyMonitor::taskError(ticket);
|
rsAutoProxyMonitor::taskError(ticket);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -203,7 +203,7 @@ void p3I2pBob::processTaskSync(taskTicket *ticket)
|
|||||||
case autoProxyTask::setSettings:
|
case autoProxyTask::setSettings:
|
||||||
// check if everything needed is set
|
// check if everything needed is set
|
||||||
if (!data) {
|
if (!data) {
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " p3I2pBob::data_tick autoProxyTask::setSettings data is missing" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " autoProxyTask::setSettings data is missing" << std::endl;
|
||||||
rsAutoProxyMonitor::taskError(ticket);
|
rsAutoProxyMonitor::taskError(ticket);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -223,7 +223,7 @@ void p3I2pBob::processTaskSync(taskTicket *ticket)
|
|||||||
break;
|
break;
|
||||||
case autoProxyTask::getErrorInfo:
|
case autoProxyTask::getErrorInfo:
|
||||||
if (!data) {
|
if (!data) {
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " p3I2pBob::data_tick autoProxyTask::getErrorInfo data is missing" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " autoProxyTask::getErrorInfo data is missing" << std::endl;
|
||||||
rsAutoProxyMonitor::taskError(ticket);
|
rsAutoProxyMonitor::taskError(ticket);
|
||||||
} else {
|
} else {
|
||||||
RS_STACK_MUTEX(mLock);
|
RS_STACK_MUTEX(mLock);
|
||||||
@ -232,7 +232,7 @@ void p3I2pBob::processTaskSync(taskTicket *ticket)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " p3I2pBob::processTaskSync unknown task" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " unknown task" << std::endl;
|
||||||
rsAutoProxyMonitor::taskError(ticket);
|
rsAutoProxyMonitor::taskError(ticket);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ int p3I2pBob::stateMachineBOB()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (answer.find(mTunnelName) == std::string::npos) {
|
if (answer.find(mTunnelName) == std::string::npos) {
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineBOB status check: tunnel down!" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " status check: tunnel down!" << std::endl;
|
||||||
// signal error
|
// signal error
|
||||||
*((bool *)mProcessing->data) = true;
|
*((bool *)mProcessing->data) = true;
|
||||||
}
|
}
|
||||||
@ -340,8 +340,8 @@ int p3I2pBob::stateMachineBOB_locked_failure(const std::string &answer, const bo
|
|||||||
return sleepFactorDefault;
|
return sleepFactorDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineBOB FAILED to run command '" + currentState.command + "'" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " FAILED to run command '" + currentState.command + "'" << std::endl;
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineBOB '" + answer + "'" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " '" + answer + "'" << std::endl;
|
||||||
|
|
||||||
mErrorMsg.append("FAILED to run command '" + currentState.command + "'" + '\n');
|
mErrorMsg.append("FAILED to run command '" + currentState.command + "'" + '\n');
|
||||||
mErrorMsg.append("reason '" + answer + "'" + '\n');
|
mErrorMsg.append("reason '" + answer + "'" + '\n');
|
||||||
@ -388,14 +388,14 @@ int p3I2pBob::stateMachineController()
|
|||||||
return stateMachineController_locked_idle();
|
return stateMachineController_locked_idle();
|
||||||
case csDoConnect:
|
case csDoConnect:
|
||||||
if (!connectI2P()) {
|
if (!connectI2P()) {
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineController doConnect: unable to connect" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " doConnect: unable to connect" << std::endl;
|
||||||
mStateOld = mState;
|
mStateOld = mState;
|
||||||
mState = csError;
|
mState = csError;
|
||||||
mErrorMsg = "unable to connect to BOB port";
|
mErrorMsg = "unable to connect to BOB port";
|
||||||
return sleepFactorSlow;
|
return sleepFactorSlow;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " stateMachineController doConnect: connected" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " doConnect: connected" << std::endl;
|
||||||
mState = csConnected;
|
mState = csConnected;
|
||||||
break;
|
break;
|
||||||
case csConnected:
|
case csConnected:
|
||||||
@ -403,7 +403,7 @@ int p3I2pBob::stateMachineController()
|
|||||||
case csWaitForBob:
|
case csWaitForBob:
|
||||||
// check connection problems
|
// check connection problems
|
||||||
if (mSocket == 0) {
|
if (mSocket == 0) {
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineController waitForBob: conection lost" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " waitForBob: conection lost" << std::endl;
|
||||||
mStateOld = mState;
|
mStateOld = mState;
|
||||||
mState = csError;
|
mState = csError;
|
||||||
mErrorMsg = "connection lost to BOB";
|
mErrorMsg = "connection lost to BOB";
|
||||||
@ -413,21 +413,21 @@ int p3I2pBob::stateMachineController()
|
|||||||
// check for finished BOB protocol
|
// check for finished BOB protocol
|
||||||
if (mBOBState == bsCleared) {
|
if (mBOBState == bsCleared) {
|
||||||
// done
|
// done
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " stateMachineController waitForBob: mBOBState == bsCleared" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " waitForBob: mBOBState == bsCleared" << std::endl;
|
||||||
mState = csDoDisconnect;
|
mState = csDoDisconnect;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case csDoDisconnect:
|
case csDoDisconnect:
|
||||||
if (!disconnectI2P() || mSocket != 0) {
|
if (!disconnectI2P() || mSocket != 0) {
|
||||||
// just in case
|
// just in case
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineController doDisconnect: can't disconnect" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " doDisconnect: can't disconnect" << std::endl;
|
||||||
mStateOld = mState;
|
mStateOld = mState;
|
||||||
mState = csError;
|
mState = csError;
|
||||||
mErrorMsg = "unable to disconnect from BOB";
|
mErrorMsg = "unable to disconnect from BOB";
|
||||||
return sleepFactorDefault;
|
return sleepFactorDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " stateMachineController doDisconnect: disconnected" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " doDisconnect: disconnected" << std::endl;
|
||||||
mState = csDisconnected;
|
mState = csDisconnected;
|
||||||
break;
|
break;
|
||||||
case csDisconnected:
|
case csDisconnected:
|
||||||
@ -458,7 +458,7 @@ int p3I2pBob::stateMachineController_locked_idle()
|
|||||||
mProcessing->task == autoProxyTask::stop ||
|
mProcessing->task == autoProxyTask::stop ||
|
||||||
mProcessing->task == autoProxyTask::proxyStatusCheck)) {
|
mProcessing->task == autoProxyTask::proxyStatusCheck)) {
|
||||||
// skip since we are not enabled
|
// skip since we are not enabled
|
||||||
Dbg1() << __PRETTY_FUNCTION__ << " stateMachineController_locked_idle: disabled -> skipping ticket" << std::endl;
|
Dbg1() << __PRETTY_FUNCTION__ << " disabled -> skipping ticket" << std::endl;
|
||||||
rsAutoProxyMonitor::taskDone(mProcessing, autoProxyStatus::disabled);
|
rsAutoProxyMonitor::taskDone(mProcessing, autoProxyStatus::disabled);
|
||||||
mProcessing = NULL;
|
mProcessing = NULL;
|
||||||
} else {
|
} else {
|
||||||
@ -480,7 +480,7 @@ int p3I2pBob::stateMachineController_locked_idle()
|
|||||||
mTask = ctRunCheck;
|
mTask = ctRunCheck;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Dbg1() << __PRETTY_FUNCTION__ << " stateMachineController_locked_idle unknown async task" << std::endl;
|
Dbg1() << __PRETTY_FUNCTION__ << " unknown async task" << std::endl;
|
||||||
rsAutoProxyMonitor::taskError(mProcessing);
|
rsAutoProxyMonitor::taskError(mProcessing);
|
||||||
mProcessing = NULL;
|
mProcessing = NULL;
|
||||||
break;
|
break;
|
||||||
@ -528,28 +528,28 @@ int p3I2pBob::stateMachineController_locked_connected()
|
|||||||
case ctRunSetUp:
|
case ctRunSetUp:
|
||||||
// when we have a key use it for server tunnel!
|
// when we have a key use it for server tunnel!
|
||||||
if(mSetting.address.privateKey.empty()) {
|
if(mSetting.address.privateKey.empty()) {
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " stateMachineController_locked_connected: setting mBOBState = setnickC" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " setting mBOBState = setnickC" << std::endl;
|
||||||
mBOBState = bsSetnickC;
|
mBOBState = bsSetnickC;
|
||||||
} else {
|
} else {
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " stateMachineController_locked_connected: setting mBOBState = setnickS" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " setting mBOBState = setnickS" << std::endl;
|
||||||
mBOBState = bsSetnickS;
|
mBOBState = bsSetnickS;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ctRunShutDown:
|
case ctRunShutDown:
|
||||||
// shut down existing tunnel
|
// shut down existing tunnel
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " stateMachineController_locked_connected: setting mBOBState = getnick" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " setting mBOBState = getnick" << std::endl;
|
||||||
mBOBState = bsGetnick;
|
mBOBState = bsGetnick;
|
||||||
break;
|
break;
|
||||||
case ctRunCheck:
|
case ctRunCheck:
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " stateMachineController_locked_connected: setting mBOBState = list" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " setting mBOBState = list" << std::endl;
|
||||||
mBOBState = bsList;
|
mBOBState = bsList;
|
||||||
break;
|
break;
|
||||||
case ctRunGetKeys:
|
case ctRunGetKeys:
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " stateMachineController_locked_connected: setting mBOBState = setnickN" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " setting mBOBState = setnickN" << std::endl;
|
||||||
mBOBState = bsSetnickN;
|
mBOBState = bsSetnickN;
|
||||||
break;
|
break;
|
||||||
case ctIdle:
|
case ctIdle:
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineController_locked_connected: task is idle. This should not happen!" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " task is idle. This should not happen!" << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,7 +565,7 @@ int p3I2pBob::stateMachineController_locked_disconnected()
|
|||||||
if(errorHappened) {
|
if(errorHappened) {
|
||||||
// reset old state
|
// reset old state
|
||||||
mStateOld = csIdel;
|
mStateOld = csIdel;
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineController_locked_disconnected: error during process!" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " error during process!" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// answer ticket
|
// answer ticket
|
||||||
@ -594,12 +594,12 @@ int p3I2pBob::stateMachineController_locked_disconnected()
|
|||||||
mTask = mTaskOld;
|
mTask = mTaskOld;
|
||||||
|
|
||||||
if (!errorHappened) {
|
if (!errorHappened) {
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " stateMachineController_locked_disconnected: run check result: ok" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " run check result: ok" << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// switch to error
|
// switch to error
|
||||||
newState = csError;
|
newState = csError;
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineController_locked_disconnected: run check result: error" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " run check result: error" << std::endl;
|
||||||
mErrorMsg = "Connection check failed. Will try to restart tunnel.";
|
mErrorMsg = "Connection check failed. Will try to restart tunnel.";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -622,7 +622,7 @@ int p3I2pBob::stateMachineController_locked_disconnected()
|
|||||||
mTask = mTaskOld;
|
mTask = mTaskOld;
|
||||||
break;
|
break;
|
||||||
case ctIdle:
|
case ctIdle:
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineController_locked_disconnected: task is idle. This should not happen!" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " task is idle. This should not happen!" << std::endl;
|
||||||
rsAutoProxyMonitor::taskError(mProcessing);
|
rsAutoProxyMonitor::taskError(mProcessing);
|
||||||
}
|
}
|
||||||
mProcessing = NULL;
|
mProcessing = NULL;
|
||||||
@ -638,7 +638,7 @@ int p3I2pBob::stateMachineController_locked_error()
|
|||||||
{
|
{
|
||||||
// wait for bob protocoll
|
// wait for bob protocoll
|
||||||
if (mBOBState != bsCleared) {
|
if (mBOBState != bsCleared) {
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " stateMachineController_locked_error: waiting for BOB" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " waiting for BOB" << std::endl;
|
||||||
return sleepFactorFast;
|
return sleepFactorFast;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,7 +653,7 @@ int p3I2pBob::stateMachineController_locked_error()
|
|||||||
switch (mTask) {
|
switch (mTask) {
|
||||||
case ctRunCheck:
|
case ctRunCheck:
|
||||||
// connection check failed at some point
|
// connection check failed at some point
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineController_locked_error: failed to check proxy status (it's likely dead)!" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " failed to check proxy status (it's likely dead)!" << std::endl;
|
||||||
*((bool *)mProcessing->data) = true;
|
*((bool *)mProcessing->data) = true;
|
||||||
mState = csDoDisconnect;
|
mState = csDoDisconnect;
|
||||||
mStateOld = csIdel;
|
mStateOld = csIdel;
|
||||||
@ -661,7 +661,7 @@ int p3I2pBob::stateMachineController_locked_error()
|
|||||||
break;
|
break;
|
||||||
case ctRunShutDown:
|
case ctRunShutDown:
|
||||||
// not a big deal though
|
// not a big deal though
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineController_locked_error: failed to shut down tunnel (it's likely dead though)!" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " failed to shut down tunnel (it's likely dead though)!" << std::endl;
|
||||||
mState = csDoDisconnect;
|
mState = csDoDisconnect;
|
||||||
mStateOld = csIdel;
|
mStateOld = csIdel;
|
||||||
mErrorMsg.clear();
|
mErrorMsg.clear();
|
||||||
@ -669,14 +669,14 @@ int p3I2pBob::stateMachineController_locked_error()
|
|||||||
case ctIdle:
|
case ctIdle:
|
||||||
// should not happen but we need to deal with it
|
// should not happen but we need to deal with it
|
||||||
// this will produce some error messages in the log and finish the task (marked as failed)
|
// this will produce some error messages in the log and finish the task (marked as failed)
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineController_locked_error: task is idle. This should not happen!" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " task is idle. This should not happen!" << std::endl;
|
||||||
mState = csDoDisconnect;
|
mState = csDoDisconnect;
|
||||||
mStateOld = csIdel;
|
mStateOld = csIdel;
|
||||||
mErrorMsg.clear();
|
mErrorMsg.clear();
|
||||||
break;
|
break;
|
||||||
case ctRunGetKeys:
|
case ctRunGetKeys:
|
||||||
case ctRunSetUp:
|
case ctRunSetUp:
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineController_locked_error: failed to receive key / start up" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " failed to receive key / start up" << std::endl;
|
||||||
mStateOld = csError;
|
mStateOld = csError;
|
||||||
mState = csDoDisconnect;
|
mState = csDoDisconnect;
|
||||||
// keep the error message
|
// keep the error message
|
||||||
@ -687,7 +687,7 @@ int p3I2pBob::stateMachineController_locked_error()
|
|||||||
|
|
||||||
// periodically retry
|
// periodically retry
|
||||||
if (mLastProxyCheck < time(NULL) - (selfCheckPeroid >> 1) && mTask == ctRunSetUp) {
|
if (mLastProxyCheck < time(NULL) - (selfCheckPeroid >> 1) && mTask == ctRunSetUp) {
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " stateMachineController_locked_error: retrying" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " retrying" << std::endl;
|
||||||
|
|
||||||
mLastProxyCheck = time(NULL);
|
mLastProxyCheck = time(NULL);
|
||||||
mErrorMsg.clear();
|
mErrorMsg.clear();
|
||||||
@ -700,7 +700,7 @@ int p3I2pBob::stateMachineController_locked_error()
|
|||||||
|
|
||||||
// check for new tickets
|
// check for new tickets
|
||||||
if (!mPending.empty()) {
|
if (!mPending.empty()) {
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " stateMachineController_locked_error: processing new ticket" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " processing new ticket" << std::endl;
|
||||||
|
|
||||||
// reset and try new task
|
// reset and try new task
|
||||||
mTask = ctIdle;
|
mTask = ctIdle;
|
||||||
@ -731,7 +731,7 @@ RsSerialiser *p3I2pBob::setupSerialiser()
|
|||||||
|
|
||||||
bool p3I2pBob::saveList(bool &cleanup, std::list<RsItem *> &lst)
|
bool p3I2pBob::saveList(bool &cleanup, std::list<RsItem *> &lst)
|
||||||
{
|
{
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " saveList" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << std::endl;
|
||||||
|
|
||||||
cleanup = true;
|
cleanup = true;
|
||||||
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet;
|
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet;
|
||||||
@ -766,7 +766,7 @@ bool p3I2pBob::saveList(bool &cleanup, std::list<RsItem *> &lst)
|
|||||||
|
|
||||||
bool p3I2pBob::loadList(std::list<RsItem *> &load)
|
bool p3I2pBob::loadList(std::list<RsItem *> &load)
|
||||||
{
|
{
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " loadList" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << std::endl;
|
||||||
|
|
||||||
for(std::list<RsItem*>::const_iterator it = load.begin(); it!=load.end(); ++it) {
|
for(std::list<RsItem*>::const_iterator it = load.begin(); it!=load.end(); ++it) {
|
||||||
RsConfigKeyValueSet *vitem = dynamic_cast<RsConfigKeyValueSet*>(*it);
|
RsConfigKeyValueSet *vitem = dynamic_cast<RsConfigKeyValueSet*>(*it);
|
||||||
@ -786,7 +786,7 @@ bool p3I2pBob::loadList(std::list<RsItem *> &load)
|
|||||||
getKVSUInt(kit, kConfigKeyOutQuantity, mSetting.outQuantity)
|
getKVSUInt(kit, kConfigKeyOutQuantity, mSetting.outQuantity)
|
||||||
getKVSUInt(kit, kConfigKeyOutVariance, mSetting.outVariance)
|
getKVSUInt(kit, kConfigKeyOutVariance, mSetting.outVariance)
|
||||||
else
|
else
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " loadList unknown key: " + kit->key << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " unknown key: " + kit->key << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete vitem;
|
delete vitem;
|
||||||
@ -850,7 +850,7 @@ void p3I2pBob::getStates(bobStates *bs)
|
|||||||
|
|
||||||
std::string p3I2pBob::executeCommand(const std::string &command)
|
std::string p3I2pBob::executeCommand(const std::string &command)
|
||||||
{
|
{
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " executeCommand_locked running '" + command + "'" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " running '" + command + "'" << std::endl;
|
||||||
|
|
||||||
std::string copy = command;
|
std::string copy = command;
|
||||||
copy.push_back('\n');
|
copy.push_back('\n');
|
||||||
@ -862,7 +862,7 @@ std::string p3I2pBob::executeCommand(const std::string &command)
|
|||||||
// receive answer (trailing new line is already removed!)
|
// receive answer (trailing new line is already removed!)
|
||||||
std::string ans = recv();
|
std::string ans = recv();
|
||||||
|
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " executeCommand_locked answer '" + ans + "'" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " answer '" + ans + "'" << std::endl;
|
||||||
|
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
@ -872,7 +872,7 @@ bool p3I2pBob::connectI2P()
|
|||||||
// there is only one thread that touches mSocket - no need for a lock
|
// there is only one thread that touches mSocket - no need for a lock
|
||||||
|
|
||||||
if (mSocket != 0) {
|
if (mSocket != 0) {
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " connectI2P_locked mSocket != 0" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " mSocket != 0" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -880,21 +880,21 @@ bool p3I2pBob::connectI2P()
|
|||||||
mSocket = unix_socket(PF_INET, SOCK_STREAM, 0);
|
mSocket = unix_socket(PF_INET, SOCK_STREAM, 0);
|
||||||
if (mSocket < 0)
|
if (mSocket < 0)
|
||||||
{
|
{
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " connectI2P_locked Failed to open socket! Socket Error: " + socket_errorType(errno) << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " Failed to open socket! Socket Error: " + socket_errorType(errno) << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// connect
|
// connect
|
||||||
int err = unix_connect(mSocket, mI2PProxyAddr);
|
int err = unix_connect(mSocket, mI2PProxyAddr);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " connectI2P_locked Failed to connect to BOB! Socket Error: " + socket_errorType(errno) << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " Failed to connect to BOB! Socket Error: " + socket_errorType(errno) << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// receive hello msg
|
// receive hello msg
|
||||||
recv();
|
recv();
|
||||||
|
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " connectI2P_locked done" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " done" << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -903,17 +903,17 @@ bool p3I2pBob::disconnectI2P()
|
|||||||
// there is only one thread that touches mSocket - no need for a lock
|
// there is only one thread that touches mSocket - no need for a lock
|
||||||
|
|
||||||
if (mSocket == 0) {
|
if (mSocket == 0) {
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " disconnectI2P_locked mSocket == 0" << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " mSocket == 0" << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int err = unix_close(mSocket);
|
int err = unix_close(mSocket);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
RsDbg() << __PRETTY_FUNCTION__ << " disconnectI2P_locked Failed to close socket! Socket Error: " + socket_errorType(errno) << std::endl;
|
RsDbg() << __PRETTY_FUNCTION__ << " Failed to close socket! Socket Error: " + socket_errorType(errno) << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " disconnectI2P_locked done" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " done" << std::endl;
|
||||||
mSocket = 0;
|
mSocket = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -934,7 +934,7 @@ std::string toString(const std::string &a, const int8_t b) {
|
|||||||
|
|
||||||
void p3I2pBob::finalizeSettings_locked()
|
void p3I2pBob::finalizeSettings_locked()
|
||||||
{
|
{
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " finalizeSettings_locked" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << std::endl;
|
||||||
|
|
||||||
sockaddr_storage_clear(mI2PProxyAddr);
|
sockaddr_storage_clear(mI2PProxyAddr);
|
||||||
// get i2p proxy addr
|
// get i2p proxy addr
|
||||||
@ -945,8 +945,8 @@ void p3I2pBob::finalizeSettings_locked()
|
|||||||
sockaddr_storage_setipv4(mI2PProxyAddr, (sockaddr_in*)&proxy);
|
sockaddr_storage_setipv4(mI2PProxyAddr, (sockaddr_in*)&proxy);
|
||||||
sockaddr_storage_setport(mI2PProxyAddr, 2827);
|
sockaddr_storage_setport(mI2PProxyAddr, 2827);
|
||||||
|
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " finalizeSettings_locked using " + sockaddr_storage_tostring(mI2PProxyAddr) << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " using " + sockaddr_storage_tostring(mI2PProxyAddr) << std::endl;
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " finalizeSettings_locked using " + mSetting.address.base32 << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " using " + mSetting.address.base32 << std::endl;
|
||||||
|
|
||||||
peerState ps;
|
peerState ps;
|
||||||
mPeerMgr->getOwnNetStatus(ps);
|
mPeerMgr->getOwnNetStatus(ps);
|
||||||
@ -961,7 +961,7 @@ void p3I2pBob::finalizeSettings_locked()
|
|||||||
std::vector<uint8_t> tmp(len);
|
std::vector<uint8_t> tmp(len);
|
||||||
RSRandom::random_bytes(tmp.data(), len);
|
RSRandom::random_bytes(tmp.data(), len);
|
||||||
const std::string location = Radix32::encode(tmp.data(), len);
|
const std::string location = Radix32::encode(tmp.data(), len);
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " finalizeSettings_locked using suffix " + location << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << " using suffix " + location << std::endl;
|
||||||
mTunnelName = "RetroShare-" + location;
|
mTunnelName = "RetroShare-" + location;
|
||||||
|
|
||||||
const std::string setnick = "setnick RetroShare-" + location;
|
const std::string setnick = "setnick RetroShare-" + location;
|
||||||
@ -1029,7 +1029,7 @@ void p3I2pBob::finalizeSettings_locked()
|
|||||||
|
|
||||||
void p3I2pBob::updateSettings_locked()
|
void p3I2pBob::updateSettings_locked()
|
||||||
{
|
{
|
||||||
Dbg4() << __PRETTY_FUNCTION__ << " updateSettings_locked" << std::endl;
|
Dbg4() << __PRETTY_FUNCTION__ << std::endl;
|
||||||
|
|
||||||
sockaddr_storage proxy;
|
sockaddr_storage proxy;
|
||||||
mPeerMgr->getProxyServerAddress(RS_HIDDEN_TYPE_I2P, proxy);
|
mPeerMgr->getProxyServerAddress(RS_HIDDEN_TYPE_I2P, proxy);
|
||||||
|
Loading…
Reference in New Issue
Block a user