Clean code

This commit is contained in:
Quentin 2019-08-13 10:58:20 +02:00
parent 0c50ca5a42
commit 5fdfd9aa9a
2 changed files with 8 additions and 5 deletions

View file

@ -23,8 +23,10 @@ int algo_dup2_on_stream(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo
union abstract_packet *ap = (union abstract_packet*) &bp->ip;
struct dup2_ctx* dup2c = app_ctx->misc;
int32_t id = -1, port = -1;
if (ctx->verbose > 1) fprintf(stderr, " [algo_dup2] Received a buffer\n");
if (ctx->verbose > 1) {
fprintf(stderr, " [algo_dup2] Received a buffer\n");
dump_buffer_packet(bp);
}
do {
switch (ap->fmt.headers.cmd) {
@ -85,8 +87,10 @@ int algo_dup2_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdin
.fmt.content.udp_metadata_thunder.id = dup2c->emit_id
};
buffer_append_ap (bp, &metadata);
if (ctx->verbose > 1) {
dump_buffer_packet(bp);
if (ctx->verbose > 1) fprintf(stderr, " [algo_dup2] Added metadata\n");
fprintf(stderr, " [algo_dup2] Added metadata\n");
}
struct evt_core_cat* cat = evt_core_get_from_cat (ctx, "tcp-write");
for (int i = 0; i < app_ctx->ap.links; i++) {

View file

@ -68,7 +68,6 @@ enum FD_STATE read_packet_from_tcp(struct evt_core_fdinfo* fdinfo, struct buffer
//fprintf(stderr, "[content] bp_aread=%d, prev_ap_aread=%ld, cur_ap_aread=%ld\n", bp->aread, ap_aread, cur_ap_aread);
while (cur_ap_aread < ap->fmt.headers.size) {
nread = read(fdinfo->fd, &(ap->raw) + cur_ap_aread, ap->fmt.headers.size - cur_ap_aread);
perror("read ap");
if (nread == 0) return FDS_AGAIN;
if (nread == -1 && errno == EAGAIN) return FDS_AGAIN;
if (nread == -1) return FDS_ERR;