Fixed an alignment bug
This commit is contained in:
parent
c77fcf148d
commit
4b48b69d92
5 changed files with 12 additions and 5 deletions
|
@ -110,9 +110,8 @@ void measlat_stop(
|
|||
int net_fd, int timer_fd) {
|
||||
if (ms->mp_in->counter < mctx->mp.max_measure) return;
|
||||
if (ms->mp_out->counter < mctx->mp.max_measure) return;
|
||||
|
||||
printf("[states] measurement %d+%d terminated\n", net_fd, timer_fd);
|
||||
measure_summary (&mctx->mp, ms);
|
||||
measure_summary (&(mctx->mp), ms);
|
||||
evt_core_rm_fd(ctx, timer_fd);
|
||||
if (!(mctx->connectionless && mctx->role == MEASLAT_SERVER))
|
||||
evt_core_rm_fd(ctx, net_fd);
|
||||
|
|
|
@ -158,6 +158,12 @@ int cmpuint64t(const void* u1, const void* u2) {
|
|||
return *i1 < *i2 ? -1 : 1;
|
||||
}
|
||||
|
||||
void measure_param_print(struct measure_params* mp) {
|
||||
fprintf(stderr,
|
||||
"measure_params {\n\tmax_measure: %lu\n\tpayload_size: %lu\n\tinterval: %lu\n\tis_server: %u\n\ttag: %s\n}\n",
|
||||
mp->max_measure, mp->payload_size, mp->interval, mp->is_server, mp->tag);
|
||||
}
|
||||
|
||||
void measure_summary(struct measure_params* mp, struct measure_state* ms) {
|
||||
char uuidstr[128];
|
||||
uuid_unparse (ms->uuid, uuidstr);
|
||||
|
|
|
@ -30,9 +30,11 @@ struct measure_packet {
|
|||
uint8_t flag;
|
||||
struct timespec emit_time;
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
void measure_params_init(struct measure_params* mp);
|
||||
void measure_params_setpl (struct measure_params* mp, size_t plsize);
|
||||
void measure_param_print(struct measure_params* mp);
|
||||
|
||||
void measure_state_init(struct measure_params* mp, struct measure_state* ms);
|
||||
void measure_state_free(struct measure_state* ms);
|
||||
|
@ -42,3 +44,4 @@ struct measure_packet* measure_generate(struct measure_params* mp, struct measur
|
|||
|
||||
void measure_next_tick(struct measure_params *mp, struct measure_state* ms, struct timespec *next);
|
||||
void measure_summary(struct measure_params* mp, struct measure_state* ms);
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ union abstract_packet {
|
|||
} content;
|
||||
} fmt;
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
struct buffer_packet {
|
||||
enum BP_MODE mode;
|
||||
|
|
|
@ -94,13 +94,11 @@ struct client_handshake {
|
|||
uint8_t methods[255];
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
struct server_handshake {
|
||||
uint8_t ver;
|
||||
uint8_t method;
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
struct client_request {
|
||||
uint8_t ver;
|
||||
uint8_t cmd;
|
||||
|
@ -110,7 +108,6 @@ struct client_request {
|
|||
uint16_t port;
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
struct server_reply {
|
||||
uint8_t ver;
|
||||
uint8_t rep;
|
||||
|
@ -119,6 +116,7 @@ struct server_reply {
|
|||
union socks5_addr bind_addr;
|
||||
uint16_t port;
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
struct socks5_ctx {
|
||||
uint16_t port;
|
||||
|
|
Loading…
Reference in a new issue