From 7dd4ef3c7c724badfe66a027ea3289d12ec0da46 Mon Sep 17 00:00:00 2001 From: Franciszek Malinka Date: Thu, 22 Apr 2021 21:14:19 +0200 Subject: Ostatnie poprawki i testy routera --- Semestr 4/sieci/pracownia2/router/router.c | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'Semestr 4/sieci/pracownia2/router/router.c') diff --git a/Semestr 4/sieci/pracownia2/router/router.c b/Semestr 4/sieci/pracownia2/router/router.c index 7262ee6..3831aac 100644 --- a/Semestr 4/sieci/pracownia2/router/router.c +++ b/Semestr 4/sieci/pracownia2/router/router.c @@ -28,34 +28,6 @@ uint16_t read_configuration(struct network_addr** networks, uint16_t **dists) { return n; } -void listen_for_routers(int sockfd, int timeout, int networks_number, struct network_addr *networks, uint16_t *dists, list_t *dv) { - // printf("Listening for %dms.\n", timeout); - char buffer[IP_MAXPACKET + 1]; - struct sockaddr_in sender; - - while (poll_socket_modify_timeout(sockfd, &timeout)) { - size_t buf_len = recv_message(sockfd, buffer, &sender); - struct vector_item new_item = parse_message(buffer, &sender); - // char addr[20]; - // inet_ntop(AF_INET, &sender.sin_addr, addr, sizeof(addr)); - // printf("Via ip: %s\n", addr); - - if (!is_from_network(sender.sin_addr, new_item.network)) { - for (int i = 0; i < networks_number; i++) { - if (is_from_network(sender.sin_addr, networks[i])) { - new_item.distance += dists[i]; - break; - } - } - new_item.is_connected_directly = false; - } - - update_dv_new_item(dv, new_item); - } - update_dv_reachability(dv); - // printf("Finished listening\n\n"); -} - void router_loop(int sockfd, int networks_number, struct network_addr *networks, uint16_t *dists) { list_t dv = create_list(); init_dv(&dv, networks_number, networks); @@ -72,7 +44,6 @@ int main() { struct network_addr* networks; uint16_t *dists; int n = read_configuration(&networks, &dists); - int sockfd = get_socket(); bind_to_port(sockfd, SERVER_PORT); -- cgit v1.2.3