Removed old linger code, formatting fixes, other minor adjustments

This commit is contained in:
Joseph Henry
2017-07-26 02:12:28 -07:00
parent b087932c88
commit b105ddb060
9 changed files with 33 additions and 62 deletions

View File

@@ -168,6 +168,10 @@ INCLUDES+=-Iext/lwip/src/include/lwip \
-Iext
endif
ifeq ($(NO_STACK),1)
CXXFLAGS+=-DNO_STACK
endif
all:
##############################################################################

View File

@@ -164,6 +164,10 @@ INCLUDES+=-Iext/lwip/src/include/lwip \
-Iext
endif
ifeq ($(NO_STACK),1)
CXXFLAGS+=-DNO_STACK
endif
all:
##############################################################################

View File

@@ -32,15 +32,12 @@
#include <ctime>
#include <sys/socket.h>
// picoTCP
#if defined(STACK_PICO)
#include "pico_socket.h"
#endif
// ZT
#include "Phy.hpp"
// SDK
#include "libzt.h"
#include "SocketTap.hpp"
#include "RingBuffer.hpp"
@@ -82,7 +79,6 @@ namespace ZeroTier {
std::time_t closure_ts;
Connection() {
TXbuf = new RingBuffer<unsigned char>(ZT_TCP_TX_BUF_SZ);
RXbuf = new RingBuffer<unsigned char>(ZT_TCP_RX_BUF_SZ);
@@ -96,27 +92,12 @@ namespace ZeroTier {
}
sdk_fd = fdpair[0];
app_fd = fdpair[1];
//DEBUG_ERROR("sdk_fd = %d, app_fd = %d", sdk_fd, app_fd);
/*
if(ZT_SOCK_BEHAVIOR_LINGER) {
struct linger so_linger;
so_linger.l_onoff = true;
so_linger.l_linger = ZT_SOCK_BEHAVIOR_LINGER_TIME;
if(setsockopt(app_fd, SOL_SOCKET, SO_LINGER, &so_linger, sizeof so_linger) < 0) {
DEBUG_ERROR("error setsockopt (%d)", errno);
}
}
*/
}
~Connection()
{
// DEBUG_INFO("~Connection() this = %p", this);
}
~Connection() { }
};
/*
* A helper object for passing SocketTaps and Connections through the stack
* A helper object for passing SocketTap(s) and Connection(s) through the stack
*/
struct ConnectionPair
{

View File

@@ -1,2 +0,0 @@
src
======

View File

@@ -24,21 +24,4 @@
* of your own application.
*/
#include <stdio.h>
#include <execinfo.h>
#include <stdlib.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
/*
void zt_dump_stacktrace(int sig) {
void *array[16];
size_t size;
size = backtrace(array, 16);
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(array, size, STDERR_FILENO);
exit(1);
}
*/
// Intentionally left blank

View File

@@ -27,11 +27,6 @@
#ifndef UTILITIES_HPP
#define UTILITIES_HPP
/*
* Print a stacktrace
*/
// void zt_dump_stacktrace(int sig);
#if defined(STACK_LWIP) && defined(LIBZT_IPV4)
#include "lwip/ip_addr.h"
@@ -53,6 +48,6 @@ inline ip_addr_t convert_ip(struct sockaddr_in * addr)
return conn_addr;
}
#endif
#endif // STACK_LWIP && LIBZT_IPV4
#endif
#endif // UTILITIES_HPP

View File

@@ -29,8 +29,8 @@
#include "libzt.h"
#include "SocketTap.hpp"
#include "Utilities.hpp"
#include "lwIP.hpp"
#include "netif/ethernet.h"
#include "lwip/etharp.h"

View File

@@ -26,7 +26,6 @@
#include <ctime>
// picoTCP
#include "pico_eth.h"
#include "pico_stack.h"
#include "pico_ipv4.h"
@@ -37,14 +36,12 @@
#include "pico_device.h"
#include "pico_ipv6.h"
// SDK
#include "libzt.h"
#include "Utilities.hpp"
#include "SocketTap.hpp"
#include "picoTCP.hpp"
#include "RingBuffer.hpp"
// ZT
#include "Utils.hpp"
#include "OSUtils.hpp"
#include "Mutex.hpp"

View File

@@ -1,15 +1,20 @@
#!/bin/bash
# create dirs to house the identities/config
mkdir -p test_identities
mkdir test_identities/alice
mkdir test_identities/bob
mkdir alice
mkdir bob
mkdir ted
mkdir carol
# generate identities
zerotier-one test_identities/alice -d
echo $! >> "test_identities/zto.alice"
zerotier-one test_identities/bob -d
echo $! >> "test_identities/zto.bob"
zerotier-one alice -d
echo $! >> "zto.alice"
zerotier-one bob -d
echo $! >> "zto.bob"
zerotier-one ted -d
echo $! >> "zto.ted"
zerotier-one carol -d
echo $! >> "zto.carol"
# should be done by now
sleep(30)
@@ -17,7 +22,11 @@ sleep(30)
# kill daemons
echo "killing daemons"
pid=$(cat test_identities/alice/zto.alice)
pid=$(cat alice/zto.alice)
kill -9 $pid
pid=$(cat test_identities/bob/zto.bob)
pid=$(cat bob/zto.bob)
kill -9 $pid
pid=$(cat ted/zto.ted)
kill -9 $pid
pid=$(cat carol/zto.carol)
kill -9 $pid