mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-20 04:14:27 -04:00
fixed compilation
This commit is contained in:
parent
b731cf34ee
commit
19e42663a0
11 changed files with 156 additions and 13 deletions
|
@ -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)
|
FsBioInterface::FsBioInterface(int socket)
|
||||||
: mCLintConnt(socket)
|
: mCLintConnt(socket)
|
||||||
{
|
{
|
||||||
|
@ -111,10 +136,12 @@ int FsBioInterface::netstatus()
|
||||||
{
|
{
|
||||||
return 1; // dummy response.
|
return 1; // dummy response.
|
||||||
}
|
}
|
||||||
|
|
||||||
int FsBioInterface::isactive()
|
int FsBioInterface::isactive()
|
||||||
{
|
{
|
||||||
return mCLintConnt > 0;
|
return mCLintConnt > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FsBioInterface::moretoread(uint32_t /* usec */)
|
bool FsBioInterface::moretoread(uint32_t /* usec */)
|
||||||
{
|
{
|
||||||
return mTotalBufferBytes > 0;
|
return mTotalBufferBytes > 0;
|
||||||
|
|
|
@ -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
|
class FsBioInterface: public BinInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -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)
|
FsClient::FsClient(const std::string& address)
|
||||||
: mServerAddress(address)
|
: mServerAddress(address)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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.
|
// This class runs a client connection to the friend server. It opens a socket at each connection.
|
||||||
|
|
||||||
class FsClient
|
class FsClient
|
||||||
|
|
|
@ -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/rsserial.h"
|
||||||
#include "serialiser/rsserializer.h"
|
#include "serialiser/rsserializer.h"
|
||||||
|
|
||||||
|
|
|
@ -406,6 +406,7 @@ HEADERS += pqi/authssl.h \
|
||||||
|
|
||||||
SOURCES += friend_server/fsclient.h \
|
SOURCES += friend_server/fsclient.h \
|
||||||
friend_server/fsbio.h \
|
friend_server/fsbio.h \
|
||||||
|
friend_server/fsitem.h \
|
||||||
friend_server/fsmanager.h
|
friend_server/fsmanager.h
|
||||||
|
|
||||||
HEADERS += rsserver/p3face.h \
|
HEADERS += rsserver/p3face.h \
|
||||||
|
|
|
@ -2,19 +2,33 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include "util/rstime.h"
|
#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
|
class RsFriendServer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void start() {}
|
virtual void start() =0;
|
||||||
void stop() {}
|
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)
|
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;
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
virtual void setFriendsToRequest(uint32_t) =0;
|
||||||
callback(addr,true);
|
|
||||||
}
|
|
||||||
void setServerAddress(const std::string&,uint16_t) {}
|
|
||||||
void setFriendsToRequest(uint32_t) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern RsFriendServer *rsFriendServer;
|
extern RsFriendServer *rsFriendServer;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "util/rsdebug.h"
|
#include "util/rsdebug.h"
|
||||||
|
|
||||||
#include "friendserver.h"
|
#include "friendserver.h"
|
||||||
#include "fsitem.h"
|
#include "friend_server/fsitem.h"
|
||||||
|
|
||||||
void FriendServer::threadTick()
|
void FriendServer::threadTick()
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include "friend_server/fsbio.h"
|
#include "friend_server/fsbio.h"
|
||||||
|
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "fsitem.h"
|
#include "friend_server/fsitem.h"
|
||||||
|
|
||||||
FsNetworkInterface::FsNetworkInterface()
|
FsNetworkInterface::FsNetworkInterface()
|
||||||
: mFsNiMtx(std::string("FsNetworkInterface"))
|
: mFsNiMtx(std::string("FsNetworkInterface"))
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "util/rsthreads.h"
|
#include "util/rsthreads.h"
|
||||||
#include "pqi/pqi_base.h"
|
#include "retroshare/rspeers.h"
|
||||||
|
|
||||||
class pqistreamer;
|
class pqistreamer;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
#include "friendserver.h"
|
#include "friendserver.h"
|
||||||
|
|
||||||
// debug
|
// debug
|
||||||
#include "fsitem.h"
|
#include "friend_server/fsitem.h"
|
||||||
|
#include "friend_server/fsclient.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue