mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -05:00
Merge pull request #2634 from csoler/v0.6-TorControl3
fixed bug in friendserver randomly dropping some incoming packets
This commit is contained in:
commit
c3c12a1a47
@ -26,6 +26,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
|
|
||||||
#include "util/rsnet.h"
|
#include "util/rsnet.h"
|
||||||
#include "util/rsprint.h"
|
#include "util/rsprint.h"
|
||||||
@ -45,6 +46,9 @@ FsNetworkInterface::FsNetworkInterface(const std::string& listening_address,uint
|
|||||||
mClintListn = 0;
|
mClintListn = 0;
|
||||||
mClintListn = socket(AF_INET, SOCK_STREAM, 0); // creating socket
|
mClintListn = socket(AF_INET, SOCK_STREAM, 0); // creating socket
|
||||||
|
|
||||||
|
int flags=1;
|
||||||
|
setsockopt(mClintListn,SOL_SOCKET,TCP_NODELAY,(char*)&flags,sizeof(flags));
|
||||||
|
|
||||||
unix_fcntl_nonblock(mClintListn);
|
unix_fcntl_nonblock(mClintListn);
|
||||||
|
|
||||||
struct sockaddr_in ipOfServer;
|
struct sockaddr_in ipOfServer;
|
||||||
@ -104,7 +108,7 @@ void FsNetworkInterface::threadTick()
|
|||||||
|
|
||||||
RS_STACK_MUTEX(mFsNiMtx);
|
RS_STACK_MUTEX(mFsNiMtx);
|
||||||
for(auto& it:mConnections)
|
for(auto& it:mConnections)
|
||||||
if(it.second.bio->isactive())
|
if(it.second.bio->isactive() || it.second.bio->moretoread(0))
|
||||||
it.second.pqi_thread->tick();
|
it.second.pqi_thread->tick();
|
||||||
else
|
else
|
||||||
to_close.push_back(it.first);
|
to_close.push_back(it.first);
|
||||||
@ -147,6 +151,9 @@ bool FsNetworkInterface::checkForNewConnections()
|
|||||||
|
|
||||||
// Make the socket non blocking so that we can read from it and return if nothing comes
|
// Make the socket non blocking so that we can read from it and return if nothing comes
|
||||||
|
|
||||||
|
int flags=1;
|
||||||
|
setsockopt(clintConnt,SOL_SOCKET,TCP_NODELAY,(char*)&flags,sizeof(flags));
|
||||||
|
|
||||||
unix_fcntl_nonblock(clintConnt);
|
unix_fcntl_nonblock(clintConnt);
|
||||||
|
|
||||||
// Create connection info
|
// Create connection info
|
||||||
|
Loading…
Reference in New Issue
Block a user