mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-22 06:09:09 -04:00
fixed control port reading
This commit is contained in:
parent
1571446a2e
commit
1c576411fb
2 changed files with 14 additions and 1 deletions
|
@ -413,12 +413,14 @@ std::string TorProcess::controlPortFilePath() const
|
|||
bool TorProcess::tryReadControlPort()
|
||||
{
|
||||
FILE *file = RsDirUtil::rs_fopen(controlPortFilePath().c_str(),"r");
|
||||
std::cerr << "Trying to read control port" << std::endl;
|
||||
|
||||
if(file)
|
||||
{
|
||||
char *line = nullptr;
|
||||
size_t tmp_buffsize = 0;
|
||||
|
||||
size_t size = getline(&line,0,file);
|
||||
size_t size = getline(&line,&tmp_buffsize,file);
|
||||
ByteArray data = ByteArray((unsigned char*)line,size).trimmed();
|
||||
free(line);
|
||||
|
||||
|
@ -428,7 +430,10 @@ bool TorProcess::tryReadControlPort()
|
|||
mControlPort = data.mid(p+1).toInt();
|
||||
|
||||
if (!mControlHost.empty() && mControlPort > 0)
|
||||
{
|
||||
std::cerr << "Read control port = " << mControlPort << std::endl;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue