doing things
This commit is contained in:
parent
cd4510a1a0
commit
5eee43c9db
2 changed files with 13 additions and 5 deletions
|
@ -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) :
|
sendto(ms->fd, head, mctx->mp.payload_size, 0, (struct sockaddr*)&mctx->addr, mctx->addrlen) :
|
||||||
send(ms->fd, head, mctx->mp.payload_size, 0);
|
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) {
|
if (s < 0 || s != mctx->mp.payload_size) {
|
||||||
perror("Send error");
|
perror("Send error");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "measure.h"
|
#include "measure.h"
|
||||||
|
|
||||||
struct torecho_ctx {
|
struct torecho_ctx {
|
||||||
uint8_t is_measlat;
|
uint8_t is_measlat, is_tor;
|
||||||
struct measure_params mp;
|
struct measure_params mp;
|
||||||
struct measure_state ms;
|
struct measure_state ms;
|
||||||
};
|
};
|
||||||
|
@ -103,8 +103,11 @@ int main(int argc, char** argv) {
|
||||||
struct torecho_ctx tctx = {0};
|
struct torecho_ctx tctx = {0};
|
||||||
tctx.mp.payload_size = 1500;
|
tctx.mp.payload_size = 1500;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "ns:m")) != -1) {
|
while ((opt = getopt(argc, argv, "ns:mt")) != -1) {
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
|
case 't':
|
||||||
|
tctx.is_tor = 1;
|
||||||
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
tof |= TOR_ONION_FLAG_NON_ANONYMOUS;
|
tof |= TOR_ONION_FLAG_NON_ANONYMOUS;
|
||||||
break;
|
break;
|
||||||
|
@ -146,9 +149,11 @@ int main(int argc, char** argv) {
|
||||||
evt_core_add_cat(&evts, &tcp_all);
|
evt_core_add_cat(&evts, &tcp_all);
|
||||||
printf("--- Categories created\n");
|
printf("--- Categories created\n");
|
||||||
|
|
||||||
// 2. Create or load onion services
|
if (tctx.is_tor) {
|
||||||
te_create_onion_services (&tos, &tctl, ports, ports_count, tof);
|
// 2. Create or load onion services
|
||||||
printf("--- Onion services created\n");
|
te_create_onion_services (&tos, &tctl, ports, ports_count, tof);
|
||||||
|
printf("--- Onion services created\n");
|
||||||
|
}
|
||||||
|
|
||||||
// 3. Create TCP server
|
// 3. Create TCP server
|
||||||
sprintf(url, "%d", ports[0]);
|
sprintf(url, "%d", ports[0]);
|
||||||
|
|
Loading…
Reference in a new issue