2021-10-08 19:08:23 -04:00
|
|
|
#include "util/rsdebug.h"
|
|
|
|
|
|
|
|
#include "friendserver.h"
|
|
|
|
#include "fsitem.h"
|
|
|
|
|
|
|
|
void FriendServer::threadTick()
|
|
|
|
{
|
|
|
|
// Listen to the network interface, capture incoming data etc.
|
|
|
|
|
2021-10-09 09:06:06 -04:00
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
|
|
|
|
|
|
|
pqi->tick();
|
2021-10-08 19:08:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
FriendServer::FriendServer(const std::string& base_dir)
|
|
|
|
{
|
2021-10-09 09:06:06 -04:00
|
|
|
RsDbg() << "Creating friend server." ;
|
2021-10-08 19:08:23 -04:00
|
|
|
mBaseDirectory = base_dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FriendServer::run()
|
|
|
|
{
|
|
|
|
// 1 - create network interface.
|
|
|
|
|
|
|
|
mni = new FsNetworkInterface;
|
2021-10-09 09:06:06 -04:00
|
|
|
mni->start();
|
2021-10-08 19:08:23 -04:00
|
|
|
|
|
|
|
RsSerialiser *rss = new RsSerialiser ;
|
|
|
|
rss->addSerialType(new FsSerializer) ;
|
|
|
|
|
|
|
|
pqi = new pqistreamer(rss, RsPeerId(), mni,BIN_FLAGS_READABLE);
|
|
|
|
|
|
|
|
while(!shouldStop()) { threadTick() ; }
|
|
|
|
}
|
|
|
|
|