Commit ca9fe2fb authored by Fong's avatar Fong
Browse files

change recv order

parent 64dab16a
...@@ -110,8 +110,6 @@ int main(int argc, char** argv) ...@@ -110,8 +110,6 @@ int main(int argc, char** argv)
} }
printf("enroll successfully, ID: %d\n", c.id); printf("enroll successfully, ID: %d\n", c.id);
pthread_t tid = wait_for_command(&c.sfd);
if (peer_id) { if (peer_id) {
printf("connecting to peer %d\n", peer_id); printf("connecting to peer %d\n", peer_id);
if (connect_to_peer(&c, peer_id) < 0) { if (connect_to_peer(&c, peer_id) < 0) {
...@@ -121,6 +119,8 @@ int main(int argc, char** argv) ...@@ -121,6 +119,8 @@ int main(int argc, char** argv)
} }
} }
pthread_t tid = wait_for_command(&c.sfd);
pthread_join(tid, NULL); pthread_join(tid, NULL);
return 0; return 0;
} }
...@@ -222,12 +222,10 @@ static void* server_notify_handler(void* data) { ...@@ -222,12 +222,10 @@ static void* server_notify_handler(void* data) {
} }
} }
verbose_log("recv command from server");
peer.port = ntohs(peer.port); peer.port = ntohs(peer.port);
peer.type = ntohs(peer.type); peer.type = ntohs(peer.type);
printf("recv command, ready to connect to %s:%d\n", peer.ip, peer.port); printf("recved command, ready to connect to %s:%d\n", peer.ip, peer.port);
struct sockaddr_in peer_addr; struct sockaddr_in peer_addr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment