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

View File

@ -153,7 +153,7 @@ void FriendServerControl::checkServerAddress()
mCurrentlyCheckingServerAddress = true; mCurrentlyCheckingServerAddress = true;
serverStatusCheckResult_LB->setMovie(mCheckingServerMovie); 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->setFileName(":/images/loader/circleball-16.gif");
mCheckingServerMovie->start(); mCheckingServerMovie->start();