Fix a strange compilation bug
This commit is contained in:
parent
9747457ce3
commit
fa02001a08
6 changed files with 16 additions and 10 deletions
|
@ -11,7 +11,7 @@ int main(int argc, char** argv) {
|
||||||
setvbuf(stdout, NULL, _IONBF, 0);
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
printf("~ Donar ~\n");
|
printf("~ Donar ~\n");
|
||||||
|
|
||||||
timing_fx_init (&static_tfx, TIMING_ACTIVATED | TIMING_DISPLAY_END, "", "fn=%s");
|
timing_fx_init (static_tfx(), TIMING_ACTIVATED | TIMING_DISPLAY_END, "", "fn=%s");
|
||||||
|
|
||||||
struct donar_params dp = {0};
|
struct donar_params dp = {0};
|
||||||
donar_init_params (&dp);
|
donar_init_params (&dp);
|
||||||
|
|
|
@ -335,7 +335,7 @@ void spawn_udp_server(struct evt_core_ctx* evts) {
|
||||||
printf("--- UDP server is listening\n");
|
printf("--- UDP server is listening\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void spawn_tor_server(struct evt_core_ctx* evts, uint16_t *ports) {
|
void spawn_tcp_server(struct evt_core_ctx* evts, uint16_t *ports) {
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
int tcp_serv_sock, err;
|
int tcp_serv_sock, err;
|
||||||
|
|
||||||
|
@ -438,13 +438,13 @@ int main(int argc, char** argv) {
|
||||||
if (mctx.mc.is_server && strcmp(mctx.transport, "udp") == 0) {
|
if (mctx.mc.is_server && strcmp(mctx.transport, "udp") == 0) {
|
||||||
spawn_udp_server (&evts);
|
spawn_udp_server (&evts);
|
||||||
mctx.is_from_needed = 1;
|
mctx.is_from_needed = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (mctx.mc.is_server && strcmp(mctx.transport, "tor") == 0) {
|
else if (mctx.mc.is_server && strcmp(mctx.transport, "tor") == 0) {
|
||||||
spawn_tor_server(&evts, ports);
|
spawn_tcp_server(&evts, ports);
|
||||||
measlat_create_onion_services (&tos, &tctl, ports, ports_count, mctx.tor_flags);
|
measlat_create_onion_services (&tos, &tctl, ports, ports_count, mctx.tor_flags);
|
||||||
printf("--- Onion services created\n");
|
printf("--- Onion services created\n");
|
||||||
}
|
}
|
||||||
|
else if (mctx.mc.is_server && strcmp(mctx.transport, "tcp") == 0) spawn_tcp_server(&evts, ports);
|
||||||
else if (strcmp(mctx.transport, "udp") == 0) spawn_udp_client(&evts);
|
else if (strcmp(mctx.transport, "udp") == 0) spawn_udp_client(&evts);
|
||||||
else if (strcmp(mctx.transport, "tor") == 0) spawn_tor_client(&evts);
|
else if (strcmp(mctx.transport, "tor") == 0) spawn_tor_client(&evts);
|
||||||
else exit(EXIT_FAILURE);
|
else exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#include "stopwatch.h"
|
#include "stopwatch.h"
|
||||||
|
|
||||||
|
struct timing_fx _static_tfx;
|
||||||
|
|
||||||
|
struct timing_fx* static_tfx() { return &_static_tfx; }
|
||||||
|
|
||||||
void timing_fx_init(struct timing_fx* tfx, enum timing_config conf, char* startt, char* endt) {
|
void timing_fx_init(struct timing_fx* tfx, enum timing_config conf, char* startt, char* endt) {
|
||||||
tfx->config = conf;
|
tfx->config = conf;
|
||||||
strncpy (tfx->start_template, startt, sizeof(tfx->start_template) - 1);
|
strncpy (tfx->start_template, startt, sizeof(tfx->start_template) - 1);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#ifndef donar_stopwatch
|
||||||
|
#define donar_stopwatch
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -22,8 +23,8 @@ struct timing_fx {
|
||||||
char start_template[255], end_template[255];
|
char start_template[255], end_template[255];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct timing_fx static_tfx;
|
struct timing_fx* static_tfx();
|
||||||
|
|
||||||
void timing_fx_init(struct timing_fx* tfx, enum timing_config conf, char* startt, char* endt);
|
void timing_fx_init(struct timing_fx* tfx, enum timing_config conf, char* startt, char* endt);
|
||||||
void timing_fx_start(struct timing_fx* tfx, ...);
|
void timing_fx_start(struct timing_fx* tfx, ...);
|
||||||
double timing_fx_stop(struct timing_fx* tfx, ...);
|
double timing_fx_stop(struct timing_fx* tfx, ...);
|
||||||
|
#endif
|
||||||
|
|
|
@ -10,9 +10,9 @@ int main(int argc, char** argv) {
|
||||||
setvbuf(stdout, NULL, _IONBF, 0);
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
printf("~ test ~\n");
|
printf("~ test ~\n");
|
||||||
|
|
||||||
timing_fx_init (&static_tfx, TIMING_ACTIVATED|TIMING_DISPLAY_END, "", "info=%s");
|
timing_fx_init (static_tfx (), TIMING_ACTIVATED|TIMING_DISPLAY_END, "", "info=%s");
|
||||||
timing_fx_start (&static_tfx);
|
timing_fx_start (static_tfx());
|
||||||
sleep(1);
|
sleep(1);
|
||||||
timing_fx_stop(&static_tfx, "sleep(1)");
|
timing_fx_stop(static_tfx(), "sleep(1)");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue