From 5eee43c9db4a4aa41cc2adefadb7c2c041da60ae Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 25 Jan 2021 16:53:08 +0100 Subject: [PATCH] doing things --- src/meas_lat.c | 3 +++ src/tor_echo.c | 15 ++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/meas_lat.c b/src/meas_lat.c index a19eacf..b30ecca 100644 --- a/src/meas_lat.c +++ b/src/meas_lat.c @@ -235,6 +235,9 @@ int on_timer(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) { sendto(ms->fd, head, mctx->mp.payload_size, 0, (struct sockaddr*)&mctx->addr, mctx->addrlen) : send(ms->fd, head, mctx->mp.payload_size, 0); + // Too bad, we will drop this packet + if (s == -1 && errno == EAGAIN) return 1; + if (s < 0 || s != mctx->mp.payload_size) { perror("Send error"); exit(EXIT_FAILURE); diff --git a/src/tor_echo.c b/src/tor_echo.c index dc59c30..a466955 100644 --- a/src/tor_echo.c +++ b/src/tor_echo.c @@ -9,7 +9,7 @@ #include "measure.h" struct torecho_ctx { - uint8_t is_measlat; + uint8_t is_measlat, is_tor; struct measure_params mp; struct measure_state ms; }; @@ -103,8 +103,11 @@ int main(int argc, char** argv) { struct torecho_ctx tctx = {0}; tctx.mp.payload_size = 1500; - while ((opt = getopt(argc, argv, "ns:m")) != -1) { + while ((opt = getopt(argc, argv, "ns:mt")) != -1) { switch(opt) { + case 't': + tctx.is_tor = 1; + break; case 'n': tof |= TOR_ONION_FLAG_NON_ANONYMOUS; break; @@ -146,9 +149,11 @@ int main(int argc, char** argv) { evt_core_add_cat(&evts, &tcp_all); printf("--- Categories created\n"); - // 2. Create or load onion services - te_create_onion_services (&tos, &tctl, ports, ports_count, tof); - printf("--- Onion services created\n"); + if (tctx.is_tor) { + // 2. Create or load onion services + te_create_onion_services (&tos, &tctl, ports, ports_count, tof); + printf("--- Onion services created\n"); + } // 3. Create TCP server sprintf(url, "%d", ports[0]);