Merge branch '16-update_neighbours' of gaufre.informatique.univ-paris-diderot.fr:perdriau/dazibao into 16-update_neighbours
This commit is contained in:
commit
82948ef639
@ -424,7 +424,7 @@ int send_packet(char *packet_buff, int16_t length, struct sockaddr_in6 *dest, in
|
|||||||
((packet*) packet_buff)->length = htons(((packet*) packet_buff)->length);
|
((packet*) packet_buff)->length = htons(((packet*) packet_buff)->length);
|
||||||
|
|
||||||
// Vectorized buffer
|
// Vectorized buffer
|
||||||
struct iovec vec_buff = {.iov_len = length, .iov_base = packet_buff};
|
struct iovec vec_buff = {.iov_len = length + 4, .iov_base = packet_buff};
|
||||||
|
|
||||||
int error_while_sending = 0;
|
int error_while_sending = 0;
|
||||||
|
|
||||||
@ -458,7 +458,7 @@ int send_packet(char *packet_buff, int16_t length, struct sockaddr_in6 *dest, in
|
|||||||
int send_single_tlv(tlv *tlv, struct sockaddr_in6 *dest, int socket_num) {
|
int send_single_tlv(tlv *tlv, struct sockaddr_in6 *dest, int socket_num) {
|
||||||
char type = tlv->pad1->type;
|
char type = tlv->pad1->type;
|
||||||
unsigned char len;
|
unsigned char len;
|
||||||
packet pack = (packet) {.magic = 95, .version = 1, .length = 4};
|
packet pack = (packet) {.magic = 95, .version = 1, .length = 0};
|
||||||
memset(pack.body, 0, 1020);
|
memset(pack.body, 0, 1020);
|
||||||
|
|
||||||
// Copy data from tlv into body
|
// Copy data from tlv into body
|
||||||
@ -1006,7 +1006,7 @@ int run_node(int sock_fd){
|
|||||||
if (bytes > 0) {
|
if (bytes > 0) {
|
||||||
printf("Received %i bytes as : %s\n", (int)bytes, output_buffer);
|
printf("Received %i bytes as : %s\n", (int)bytes, output_buffer);
|
||||||
// Treat incoming packets.
|
// Treat incoming packets.
|
||||||
int work_tlv_status = listen_for_packets(&output_buffer, bytes, &sender, sock_fd);
|
int work_tlv_status = listen_for_packets(output_buffer, bytes, &sender, sock_fd);
|
||||||
if (work_tlv_status < 0) {
|
if (work_tlv_status < 0) {
|
||||||
perror(">> Error while treating the incoming packet.");
|
perror(">> Error while treating the incoming packet.");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user