mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
Misc changes
This commit is contained in:
parent
b96c08f35c
commit
0405ba1ccf
9 changed files with 128 additions and 110 deletions
Binary file not shown.
|
@ -116,7 +116,7 @@
|
||||||
#define MEM_SIZE 1024 * 1024 * 64
|
#define MEM_SIZE 1024 * 1024 * 64
|
||||||
#define TCP_SND_BUF 1024 * 63
|
#define TCP_SND_BUF 1024 * 63
|
||||||
|
|
||||||
|
#define TCP_SND_QUEUELEN 1024
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
-------------------------- Internal Memory Pool Sizes --------------------------
|
-------------------------- Internal Memory Pool Sizes --------------------------
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -157,7 +157,7 @@
|
||||||
* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
|
* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
|
||||||
* (requires the LWIP_TCP option)
|
* (requires the LWIP_TCP option)
|
||||||
*/
|
*/
|
||||||
#define MEMP_NUM_TCP_SEG 128
|
#define MEMP_NUM_TCP_SEG 1024
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MEMP_NUM_REASSDATA: the number of simultaneously IP packets queued for
|
* MEMP_NUM_REASSDATA: the number of simultaneously IP packets queued for
|
||||||
|
|
|
@ -494,6 +494,13 @@ int connect(CONNECT_SIG)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//int flags = fcntl(__fd, F_GETFD);
|
||||||
|
//dwr("connect(): socket flags = %d\n", flags);
|
||||||
|
|
||||||
|
if(sock_type && O_NONBLOCK) {
|
||||||
|
dwr("connect(): O_NONBLOCK\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* assemble and route command */
|
/* assemble and route command */
|
||||||
int err;
|
int err;
|
||||||
char cmd[BUF_SZ];
|
char cmd[BUF_SZ];
|
||||||
|
@ -507,6 +514,10 @@ int connect(CONNECT_SIG)
|
||||||
memcpy(&cmd[1], &rpc_st, sizeof(struct connect_st));
|
memcpy(&cmd[1], &rpc_st, sizeof(struct connect_st));
|
||||||
pthread_mutex_lock(&lock);
|
pthread_mutex_lock(&lock);
|
||||||
send_command(fdret_sock, cmd);
|
send_command(fdret_sock, cmd);
|
||||||
|
if(sock_type && O_NONBLOCK) {
|
||||||
|
//pthread_mutex_unlock(&lock);
|
||||||
|
//return EINPROGRESS;
|
||||||
|
}
|
||||||
err = get_retval();
|
err = get_retval();
|
||||||
pthread_mutex_unlock(&lock);
|
pthread_mutex_unlock(&lock);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -318,6 +318,8 @@ void NetconEthernetTap::threadMain()
|
||||||
fprintf(stderr, "_threadMain()\n");
|
fprintf(stderr, "_threadMain()\n");
|
||||||
uint64_t prev_tcp_time = 0;
|
uint64_t prev_tcp_time = 0;
|
||||||
uint64_t prev_etharp_time = 0;
|
uint64_t prev_etharp_time = 0;
|
||||||
|
fprintf(stderr, "- TCP_SND_QUEUELEN = %d\n", TCP_SND_QUEUELEN);
|
||||||
|
fprintf(stderr, "- TCP_MAXRTX = %d\n", TCP_MAXRTX);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
fprintf(stderr, "- MEM_SIZE = %dM\n", MEM_SIZE / (1024*1024));
|
fprintf(stderr, "- MEM_SIZE = %dM\n", MEM_SIZE / (1024*1024));
|
||||||
|
@ -327,7 +329,7 @@ void NetconEthernetTap::threadMain()
|
||||||
fprintf(stderr, "- MEMP_NUM_TCP_PCB_LISTEN = %d\n", MEMP_NUM_TCP_PCB_LISTEN);
|
fprintf(stderr, "- MEMP_NUM_TCP_PCB_LISTEN = %d\n", MEMP_NUM_TCP_PCB_LISTEN);
|
||||||
fprintf(stderr, "- MEMP_NUM_TCP_SEG = %d\n", MEMP_NUM_TCP_SEG);
|
fprintf(stderr, "- MEMP_NUM_TCP_SEG = %d\n", MEMP_NUM_TCP_SEG);
|
||||||
fprintf(stderr, "- PBUF_POOL_SIZE = %d\n", PBUF_POOL_SIZE);
|
fprintf(stderr, "- PBUF_POOL_SIZE = %d\n", PBUF_POOL_SIZE);
|
||||||
fprintf(stderr, "- TCP_SND_QUEUELEN = %d\n", TCP_SND_QUEUELEN);
|
|
||||||
fprintf(stderr, "- IP_REASSEMBLY = %d\n", IP_REASSEMBLY);
|
fprintf(stderr, "- IP_REASSEMBLY = %d\n", IP_REASSEMBLY);
|
||||||
fprintf(stderr, "- TCP_WND = %d\n", TCP_WND);
|
fprintf(stderr, "- TCP_WND = %d\n", TCP_WND);
|
||||||
fprintf(stderr, "- TCP_MSS = %d\n", TCP_MSS);
|
fprintf(stderr, "- TCP_MSS = %d\n", TCP_MSS);
|
||||||
|
@ -376,9 +378,13 @@ void NetconEthernetTap::phyOnFileDescriptorActivity(PhySocket *sock,void **uptr,
|
||||||
{
|
{
|
||||||
if(readable) {
|
if(readable) {
|
||||||
TcpConnection *conn = (TcpConnection*)*uptr;
|
TcpConnection *conn = (TcpConnection*)*uptr;
|
||||||
Mutex::Lock _l(lwipstack->_lock);
|
|
||||||
if(conn->dataSock) // Sometimes a connection may be closed via nc_recved, check first
|
if(conn->dataSock) // Sometimes a connection may be closed via nc_recved, check first
|
||||||
|
{
|
||||||
|
//Mutex::Lock _l(lwipstack->_lock);
|
||||||
|
//lwipstack->_lock.lock();
|
||||||
handle_write(conn);
|
handle_write(conn);
|
||||||
|
//lwipstack->_lock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "phyOnFileDescriptorActivity(): PhySocket not readable\n");
|
fprintf(stderr, "phyOnFileDescriptorActivity(): PhySocket not readable\n");
|
||||||
|
@ -1144,8 +1150,9 @@ void NetconEthernetTap::handle_write(TcpConnection *conn)
|
||||||
// NOTE: this assumes that lwipstack->_lock is locked, either
|
// NOTE: this assumes that lwipstack->_lock is locked, either
|
||||||
// because we are in a callback or have locked it manually.
|
// because we are in a callback or have locked it manually.
|
||||||
int err = lwipstack->_tcp_write(conn->pcb, &conn->buf, r, TCP_WRITE_FLAG_COPY);
|
int err = lwipstack->_tcp_write(conn->pcb, &conn->buf, r, TCP_WRITE_FLAG_COPY);
|
||||||
|
lwipstack->_tcp_output(conn->pcb);
|
||||||
if(err != ERR_OK) {
|
if(err != ERR_OK) {
|
||||||
fprintf(stderr, "handle_write(): error while writing to PCB\n");
|
fprintf(stderr, "handle_write(): error while writing to PCB, (err = %d)\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Binary file not shown.
BIN
netcon/liblwip.so
Executable file
BIN
netcon/liblwip.so
Executable file
Binary file not shown.
Loading…
Add table
Reference in a new issue