fixed compilation

This commit is contained in:
csoler 2021-10-24 20:01:19 +02:00
parent b731cf34ee
commit 19e42663a0
11 changed files with 156 additions and 13 deletions

View File

@ -1,3 +1,28 @@
/*******************************************************************************
* libretroshare/src/file_sharing: fsbio.cc *
* *
* libretroshare: retroshare core library *
* *
* Copyright 2021 by retroshare team <retroshare.project@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
******************************************************************************/
#include "util/rsprint.h"
#include "fsbio.h"
FsBioInterface::FsBioInterface(int socket)
: mCLintConnt(socket)
{
@ -111,10 +136,12 @@ int FsBioInterface::netstatus()
{
return 1; // dummy response.
}
int FsBioInterface::isactive()
{
return mCLintConnt > 0;
}
bool FsBioInterface::moretoread(uint32_t /* usec */)
{
return mTotalBufferBytes > 0;

View File

@ -1,3 +1,27 @@
/*******************************************************************************
* libretroshare/src/file_sharing: fsbio.h *
* *
* libretroshare: retroshare core library *
* *
* Copyright 2021 by retroshare team <retroshare.project@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
******************************************************************************/
#include "pqi/pqi_base.h"
class FsBioInterface: public BinInterface
{
public:

View File

@ -1,3 +1,30 @@
/*******************************************************************************
* libretroshare/src/file_sharing: fsclient.cc *
* *
* libretroshare: retroshare core library *
* *
* Copyright 2021 by retroshare team <retroshare.project@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
******************************************************************************/
#include "pqi/pqithreadstreamer.h"
#include "fsclient.h"
#include "fsbio.h"
FsClient::FsClient(const std::string& address)
: mServerAddress(address)
{

View File

@ -1,3 +1,28 @@
/*******************************************************************************
* libretroshare/src/file_sharing: fsclient.h *
* *
* libretroshare: retroshare core library *
* *
* Copyright 2021 by retroshare team <retroshare.project@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
******************************************************************************/
#include <string>
#include "fsitem.h"
// This class runs a client connection to the friend server. It opens a socket at each connection.
class FsClient

View File

@ -1,3 +1,27 @@
/*******************************************************************************
* libretroshare/src/file_sharing: fsitem.h *
* *
* libretroshare: retroshare core library *
* *
* Copyright 2021 by retroshare team <retroshare.project@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
******************************************************************************/
#pragma once
#include "serialiser/rsserial.h"
#include "serialiser/rsserializer.h"

View File

@ -406,6 +406,7 @@ HEADERS += pqi/authssl.h \
SOURCES += friend_server/fsclient.h \
friend_server/fsbio.h \
friend_server/fsitem.h \
friend_server/fsmanager.h
HEADERS += rsserver/p3face.h \

View File

@ -2,19 +2,33 @@
#include <thread>
#include "util/rstime.h"
// The Friend Server component of Retroshare automatically adds/removes some friends so that the
//
// The current strategy is:
//
// - if total nb of friends < S
// request new friends to the FS
// - if total nb of friends >= S
// do not request anymore (and unpublish the key), but keep the friends already here
//
// Possible states:
// - not started
// - maintain friend list
// - actively request friends
//
// The friend server internally keeps track of which friends have been added using the friend server.
// It's important to keep the ones that are already connected because they may count on us.
// Friends supplied by the FS who never connected for a few days should be removed automatically.
class RsFriendServer
{
public:
void start() {}
void stop() {}
virtual void start() =0;
virtual void stop() =0;
void checkServerAddress_async(const std::string& addr,uint16_t, const std::function<void (const std::string& address,bool result_status)>& callback)
{
std::this_thread::sleep_for(std::chrono::seconds(1));
callback(addr,true);
}
void setServerAddress(const std::string&,uint16_t) {}
void setFriendsToRequest(uint32_t) {}
virtual void checkServerAddress_async(const std::string& addr,uint16_t, const std::function<void (const std::string& address,bool result_status)>& callback) =0;
virtual void setServerAddress(const std::string&,uint16_t) =0;
virtual void setFriendsToRequest(uint32_t) =0;
};
extern RsFriendServer *rsFriendServer;

View File

@ -1,7 +1,7 @@
#include "util/rsdebug.h"
#include "friendserver.h"
#include "fsitem.h"
#include "friend_server/fsitem.h"
void FriendServer::threadTick()
{

View File

@ -38,7 +38,7 @@
#include "friend_server/fsbio.h"
#include "network.h"
#include "fsitem.h"
#include "friend_server/fsitem.h"
FsNetworkInterface::FsNetworkInterface()
: mFsNiMtx(std::string("FsNetworkInterface"))

View File

@ -22,7 +22,7 @@
#pragma once
#include "util/rsthreads.h"
#include "pqi/pqi_base.h"
#include "retroshare/rspeers.h"
class pqistreamer;

View File

@ -27,7 +27,8 @@
#include "friendserver.h"
// debug
#include "fsitem.h"
#include "friend_server/fsitem.h"
#include "friend_server/fsclient.h"
int main(int argc, char* argv[])
{