Fix a stupid bug

This commit is contained in:
Quentin 2019-05-23 22:53:00 +02:00
parent ccd5fe14a2
commit 7d7b40724c
3 changed files with 9 additions and 9 deletions

View file

@ -194,9 +194,6 @@ int algo_rr_on_stream(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo,
}
return 0;
co_error:
perror("Failed to TCP read");
exit(EXIT_FAILURE);
}
int algo_rr_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct buffer_packet* bp) {
@ -280,10 +277,6 @@ not_ready:
fprintf(stderr, "Still bootstrapping or no link to forward data from %s in udp-read. Dropping packet :( \n", fdinfo->url);
mv_buffer_wtof (app_ctx, fdinfo);
return 0;
co_error:
perror("Failed to UDP read");
exit(EXIT_FAILURE);
}
void on_timeout_health (struct evt_core_ctx* ctx, void* raw) {

View file

@ -184,7 +184,11 @@ void mv_buffer_atof(struct algo_ctx* app_ctx, void* from) {
exit(EXIT_FAILURE);
}
// 2. We move it
// 2. Reset it
bp->mode = BP_READING;
bp->aread = 0;
// 3. We move it
g_hash_table_remove (app_ctx->application_waiting, from);
g_queue_push_tail (app_ctx->free_buffer, bp);
}

View file

@ -87,7 +87,10 @@ enum FD_STATE write_packet_to_udp(int fd, struct buffer_packet* bp, struct udp_t
enum FD_STATE read_packet_from_udp (int fd, struct buffer_packet* bp, struct udp_target* udp_t) {
ssize_t nread;
if (bp->mode != BP_READING) return FDS_ERR;
if (bp->mode != BP_READING) {
fprintf(stderr, "Buffer packet is not in reading mode\n");
return FDS_ERR;
}
size_t pkt_header_size = sizeof(bp->ip.ap.fmt.headers) + sizeof(bp->ip.ap.fmt.content.clear) - sizeof(char); // We remove the payload
size_t udp_packet_size = sizeof(struct internet_packet) - pkt_header_size;