edited link_state.c to terminate the thread, close the file descriptor and free memory associated with a peer