doing things

This commit is contained in:
Quentin 2021-01-25 16:53:08 +01:00
parent cd4510a1a0
commit 5eee43c9db
2 changed files with 13 additions and 5 deletions

View File

@ -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);

View File

@ -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]);