mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-05 09:35:39 -05:00
changed names SocketBioInterface->RsFdBinInterface and TcpSocket->RsTcpSocket (more consistent). Moved them to pqi/
This commit is contained in:
parent
a5b1f2d976
commit
0a5f3328df
@ -24,7 +24,7 @@
|
||||
#include "retroshare/rspeers.h"
|
||||
|
||||
#include "fsclient.h"
|
||||
#include "fsbio.h"
|
||||
#include "pqi/pqifdbin.h"
|
||||
|
||||
bool FsClient::requestFriends(const std::string& address,uint16_t port,uint32_t reqs,std::map<std::string,bool>& friend_certificates)
|
||||
{
|
||||
@ -130,7 +130,7 @@ bool FsClient::sendItem(const std::string& address,uint16_t port,RsItem *item,st
|
||||
// FsSerializer().serialise(item,data,&size);
|
||||
// write(CreateSocket,data,size); // shouldn't we use the pqistreamer in R/W mode instead?
|
||||
|
||||
FsBioInterface *bio = new FsBioInterface(CreateSocket); // deleted by ~pqistreamer()
|
||||
RsFdBinInterface *bio = new RsFdBinInterface(CreateSocket); // deleted by ~pqistreamer()
|
||||
|
||||
pqithreadstreamer p(this,rss,RsPeerId(),bio,BIN_FLAGS_READABLE | BIN_FLAGS_WRITEABLE | BIN_FLAGS_NO_CLOSE);
|
||||
p.start();
|
||||
|
@ -156,7 +156,6 @@ rs_webui {
|
||||
}
|
||||
|
||||
HEADERS += plugins/pluginmanager.h \
|
||||
friend_server/socketbio.h \
|
||||
plugins/dlfcn_win32.h \
|
||||
rsitems/rspluginitems.h \
|
||||
util/i2pcommon.h \
|
||||
@ -366,6 +365,8 @@ HEADERS += pqi/authssl.h \
|
||||
pqi/authgpg.h \
|
||||
pgp/pgphandler.h \
|
||||
pgp/pgpkeyutil.h \
|
||||
pqi/pqifdbin.h \
|
||||
pqi/rstcpsocket.h \
|
||||
pgp/rscertificate.h \
|
||||
pgp/pgpauxutils.h \
|
||||
pqi/p3cfgmgr.h \
|
||||
@ -406,9 +407,7 @@ HEADERS += pqi/authssl.h \
|
||||
|
||||
SOURCES += friend_server/fsclient.h \
|
||||
friend_server/fsitem.h \
|
||||
friend_server/fsmanager.h \
|
||||
friend_server/socketbio.cc \
|
||||
friend_server/tcpsocket.h
|
||||
friend_server/fsmanager.h
|
||||
|
||||
HEADERS += rsserver/p3face.h \
|
||||
rsserver/p3history.h \
|
||||
@ -548,6 +547,8 @@ SOURCES += pqi/authgpg.cc \
|
||||
pqi/p3cfgmgr.cc \
|
||||
pqi/p3peermgr.cc \
|
||||
pqi/p3linkmgr.cc \
|
||||
pqi/pqifdbin.cc \
|
||||
pqi/rstcpsocket.cc \
|
||||
pqi/p3netmgr.cc \
|
||||
pqi/p3notify.cc \
|
||||
pqi/pqiqos.cc \
|
||||
@ -574,8 +575,7 @@ SOURCES += pqi/authgpg.cc \
|
||||
pqi/p3servicecontrol.cc
|
||||
|
||||
SOURCES += friend_server/fsclient.cc \
|
||||
friend_server/fsmanager.cc \
|
||||
friend_server/tcpsocket.cc
|
||||
friend_server/fsmanager.cc
|
||||
|
||||
SOURCES += rsserver/p3face-config.cc \
|
||||
rsserver/p3face-server.cc \
|
||||
|
@ -21,10 +21,10 @@
|
||||
******************************************************************************/
|
||||
|
||||
#include "util/rsprint.h"
|
||||
#include "fsbio.h"
|
||||
#include "pqi/pqifdbin.h"
|
||||
|
||||
FsBioInterface::FsBioInterface(int socket)
|
||||
: mCLintConnt(socket),mIsActive(socket!=0)
|
||||
RsFdBinInterface::RsFdBinInterface(int file_descriptor)
|
||||
: mCLintConnt(file_descriptor),mIsActive(file_descriptor!=0)
|
||||
{
|
||||
mTotalReadBytes=0;
|
||||
mTotalInBufferBytes=0;
|
||||
@ -32,7 +32,7 @@ FsBioInterface::FsBioInterface(int socket)
|
||||
mTotalOutBufferBytes=0;
|
||||
}
|
||||
|
||||
void FsBioInterface::setSocket(int s)
|
||||
void RsFdBinInterface::setSocket(int s)
|
||||
{
|
||||
if(mIsActive != 0)
|
||||
{
|
||||
@ -42,7 +42,7 @@ void FsBioInterface::setSocket(int s)
|
||||
mCLintConnt = s;
|
||||
mIsActive = (s!=0);
|
||||
}
|
||||
int FsBioInterface::tick()
|
||||
int RsFdBinInterface::tick()
|
||||
{
|
||||
if(!mIsActive)
|
||||
{
|
||||
@ -59,7 +59,7 @@ int FsBioInterface::tick()
|
||||
return res;
|
||||
}
|
||||
|
||||
int FsBioInterface::read_pending()
|
||||
int RsFdBinInterface::read_pending()
|
||||
{
|
||||
char inBuffer[1025];
|
||||
memset(inBuffer,0,1025);
|
||||
@ -107,7 +107,7 @@ int FsBioInterface::read_pending()
|
||||
return mTotalInBufferBytes;
|
||||
}
|
||||
|
||||
int FsBioInterface::write_pending()
|
||||
int RsFdBinInterface::write_pending()
|
||||
{
|
||||
if(out_buffer.empty())
|
||||
return mTotalOutBufferBytes;
|
||||
@ -160,12 +160,12 @@ int FsBioInterface::write_pending()
|
||||
return mTotalOutBufferBytes;
|
||||
}
|
||||
|
||||
FsBioInterface::~FsBioInterface()
|
||||
RsFdBinInterface::~RsFdBinInterface()
|
||||
{
|
||||
clean();
|
||||
}
|
||||
|
||||
void FsBioInterface::clean()
|
||||
void RsFdBinInterface::clean()
|
||||
{
|
||||
for(auto p:in_buffer) free(p.first);
|
||||
for(auto p:out_buffer) free(p.first);
|
||||
@ -173,7 +173,7 @@ void FsBioInterface::clean()
|
||||
in_buffer.clear();
|
||||
out_buffer.clear();
|
||||
}
|
||||
int FsBioInterface::readdata(void *data, int len)
|
||||
int RsFdBinInterface::readdata(void *data, int len)
|
||||
{
|
||||
// read incoming bytes in the buffer
|
||||
|
||||
@ -217,7 +217,7 @@ int FsBioInterface::readdata(void *data, int len)
|
||||
return len;
|
||||
}
|
||||
|
||||
int FsBioInterface::senddata(void *data, int len)
|
||||
int RsFdBinInterface::senddata(void *data, int len)
|
||||
{
|
||||
// shouldn't we better send in multiple packets, similarly to how we read?
|
||||
|
||||
@ -240,26 +240,26 @@ int FsBioInterface::senddata(void *data, int len)
|
||||
mTotalOutBufferBytes += len;
|
||||
return len;
|
||||
}
|
||||
int FsBioInterface::netstatus()
|
||||
int RsFdBinInterface::netstatus()
|
||||
{
|
||||
return mIsActive; // dummy response.
|
||||
}
|
||||
|
||||
int FsBioInterface::isactive()
|
||||
int RsFdBinInterface::isactive()
|
||||
{
|
||||
return mIsActive ;
|
||||
}
|
||||
|
||||
bool FsBioInterface::moretoread(uint32_t /* usec */)
|
||||
bool RsFdBinInterface::moretoread(uint32_t /* usec */)
|
||||
{
|
||||
return mTotalInBufferBytes > 0;
|
||||
}
|
||||
bool FsBioInterface::cansend(uint32_t)
|
||||
bool RsFdBinInterface::cansend(uint32_t)
|
||||
{
|
||||
return isactive();
|
||||
}
|
||||
|
||||
int FsBioInterface::close()
|
||||
int RsFdBinInterface::close()
|
||||
{
|
||||
RsDbg() << "Stopping network interface" << std::endl;
|
||||
mIsActive = false;
|
@ -22,11 +22,11 @@
|
||||
|
||||
#include "pqi/pqi_base.h"
|
||||
|
||||
class FsBioInterface: public BinInterface
|
||||
class RsFdBinInterface: public BinInterface
|
||||
{
|
||||
public:
|
||||
FsBioInterface(int socket);
|
||||
~FsBioInterface();
|
||||
RsFdBinInterface(int file_descriptor);
|
||||
~RsFdBinInterface();
|
||||
|
||||
// Implements BinInterface methods
|
||||
|
@ -4,13 +4,13 @@
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "tcpsocket.h"
|
||||
#include "rstcpsocket.h"
|
||||
|
||||
TcpSocket::TcpSocket(const std::string& tcp_address,uint16_t tcp_port)
|
||||
:FsBioInterface(0),mState(DISCONNECTED),mConnectAddress(tcp_address),mConnectPort(tcp_port),mSocket(0)
|
||||
RsTcpSocket::RsTcpSocket(const std::string& tcp_address,uint16_t tcp_port)
|
||||
:RsFdBinInterface(0),mState(DISCONNECTED),mConnectAddress(tcp_address),mConnectPort(tcp_port),mSocket(0)
|
||||
{
|
||||
}
|
||||
int TcpSocket::connect()
|
||||
int RsTcpSocket::connect()
|
||||
{
|
||||
int CreateSocket = 0;
|
||||
char dataReceived[1024];
|
||||
@ -39,19 +39,19 @@ int TcpSocket::connect()
|
||||
return true;
|
||||
}
|
||||
|
||||
int TcpSocket::close()
|
||||
int RsTcpSocket::close()
|
||||
{
|
||||
FsBioInterface::close();
|
||||
RsFdBinInterface::close();
|
||||
|
||||
return !::close(mSocket);
|
||||
}
|
||||
|
||||
ThreadedTcpSocket::ThreadedTcpSocket(const std::string& tcp_address,uint16_t tcp_port)
|
||||
: TcpSocket(tcp_address,tcp_port)
|
||||
RsThreadedTcpSocket::RsThreadedTcpSocket(const std::string& tcp_address,uint16_t tcp_port)
|
||||
: RsTcpSocket(tcp_address,tcp_port)
|
||||
{
|
||||
}
|
||||
|
||||
void ThreadedTcpSocket::run()
|
||||
void RsThreadedTcpSocket::run()
|
||||
{
|
||||
if(!connect())
|
||||
{
|
||||
@ -67,7 +67,7 @@ void ThreadedTcpSocket::run()
|
||||
RsWarn() << "Connection to " << connectAddress() << ":" << connectPort() << " is now closed.";
|
||||
}
|
||||
|
||||
ThreadedTcpSocket::~ThreadedTcpSocket()
|
||||
RsThreadedTcpSocket::~RsThreadedTcpSocket()
|
||||
{
|
||||
fullstop(); // fully wait for stopping.
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include <string>
|
||||
#include "util/rsthreads.h"
|
||||
#include "friend_server/fsbio.h"
|
||||
#include "pqi/pqifdbin.h"
|
||||
|
||||
class TcpSocket: public FsBioInterface
|
||||
class RsTcpSocket: public RsFdBinInterface
|
||||
{
|
||||
public:
|
||||
TcpSocket(const std::string& tcp_address,uint16_t tcp_port);
|
||||
RsTcpSocket(const std::string& tcp_address,uint16_t tcp_port);
|
||||
|
||||
enum State: uint8_t {
|
||||
UNKNOWN = 0x00,
|
||||
@ -30,11 +30,11 @@ private:
|
||||
int mSocket;
|
||||
};
|
||||
|
||||
class ThreadedTcpSocket: public TcpSocket, public RsThread
|
||||
class RsThreadedTcpSocket: public RsTcpSocket, public RsThread
|
||||
{
|
||||
public:
|
||||
ThreadedTcpSocket(const std::string& tcp_address,uint16_t tcp_port);
|
||||
virtual ~ThreadedTcpSocket();
|
||||
RsThreadedTcpSocket(const std::string& tcp_address,uint16_t tcp_port);
|
||||
virtual ~RsThreadedTcpSocket();
|
||||
|
||||
virtual void run() override;
|
||||
};
|
@ -35,7 +35,7 @@
|
||||
#include "util/rsdebug.h"
|
||||
|
||||
#include "pqi/pqithreadstreamer.h"
|
||||
#include "friend_server/fsbio.h"
|
||||
#include "pqi/pqifdbin.h"
|
||||
|
||||
#include "network.h"
|
||||
#include "friend_server/fsitem.h"
|
||||
@ -154,7 +154,7 @@ bool FsNetworkInterface::checkForNewConnections()
|
||||
RsSerialiser *rss = new RsSerialiser ;
|
||||
rss->addSerialType(new FsSerializer) ;
|
||||
|
||||
FsBioInterface *bio = new FsBioInterface(clintConnt);
|
||||
RsFdBinInterface *bio = new RsFdBinInterface(clintConnt);
|
||||
|
||||
auto pqi = new pqithreadstreamer(this,rss, pid, bio,BIN_FLAGS_READABLE | BIN_FLAGS_WRITEABLE);
|
||||
|
||||
|
@ -26,14 +26,14 @@
|
||||
#include "retroshare/rspeers.h"
|
||||
|
||||
class pqithreadstreamer;
|
||||
class FsBioInterface;
|
||||
class RsFdBinInterface;
|
||||
|
||||
struct ConnectionData
|
||||
{
|
||||
sockaddr client_address;
|
||||
int socket;
|
||||
pqithreadstreamer *pqi_thread;
|
||||
FsBioInterface *bio;
|
||||
RsFdBinInterface *bio;
|
||||
|
||||
std::list<RsItem*> incoming_items;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user