added missing documentation in BinInterface::readdata(), and fixed bug in FdBinInterface not implementing readdata() correctly

This commit is contained in:
csoler 2022-10-06 14:26:53 +02:00
parent d307b46c15
commit f3ee68411d
2 changed files with 27 additions and 12 deletions

View File

@ -113,15 +113,19 @@ void FsNetworkInterface::threadTick()
std::list<RsPeerId> to_close;
RS_STACK_MUTEX(mFsNiMtx);
for(auto& it:mConnections)
if(it.second.bio->isactive() || it.second.bio->moretoread(0))
{
RS_STACK_MUTEX(mFsNiMtx);
for(auto& it:mConnections)
{
it.second.pqi_thread->tick();
else
to_close.push_back(it.first);
for(const auto& pid:to_close)
locked_closeConnection(pid);
if(!it.second.bio->isactive() && !it.second.bio->moretoread(0))
to_close.push_back(it.first);
}
for(const auto& pid:to_close)
locked_closeConnection(pid);
}
std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
@ -165,12 +169,17 @@ bool FsNetworkInterface::checkForNewConnections()
// Create connection info
RsDbg() << " Creating connection data." ;
ConnectionData c;
c.socket = clintConnt;
c.client_address = addr;
RsPeerId pid = makePeerId(clintConnt);
RsDbg() << " socket: " << clintConnt;
RsDbg() << " client address: " << sockaddr_storage_tostring(*(sockaddr_storage*)&addr);
RsDbg() << " peer id: " << pid ;
// Setup a pqistreamer to deserialize whatever comes from this connection
RsSerialiser *rss = new RsSerialiser ;
@ -183,11 +192,14 @@ bool FsNetworkInterface::checkForNewConnections()
c.pqi_thread = pqi;
c.bio = bio;
pqi->start();
{
RS_STACK_MUTEX(mFsNiMtx);
mConnections[pid] = c;
RS_STACK_MUTEX(mFsNiMtx);
mConnections[pid] = c;
pqi->start();
}
RsDbg() << " streamer has properly started." ;
return true;
}
@ -195,6 +207,8 @@ bool FsNetworkInterface::RecvItem(RsItem *item)
{
RS_STACK_MUTEX(mFsNiMtx);
RsDbg() << "FsNetworkInterface: received item " << (void*)item;
auto it = mConnections.find(item->PeerId());
if(it == mConnections.end())
@ -219,6 +233,7 @@ RsItem *FsNetworkInterface::GetItem()
RsItem *item = it.second.incoming_items.front();
it.second.incoming_items.pop_front();
RsDbg() << "FsNetworkInterface: returning item " << (void*)item << " to caller.";
return item;
}
}

View File

@ -153,7 +153,7 @@ void FriendServerControl::checkServerAddress()
mCurrentlyCheckingServerAddress = true;
serverStatusCheckResult_LB->setMovie(mCheckingServerMovie);
serverStatusCheckResult_LB->setToolTip(tr("Friend server is currently reachable.")) ;
serverStatusCheckResult_LB->setToolTip(tr("Trying to contact friend server\nThis may take up to 1 min.")) ;
mCheckingServerMovie->setFileName(":/images/loader/circleball-16.gif");
mCheckingServerMovie->start();