X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Finvitation.c;h=749870458e61a7ec9f3292af831c9d2401bc6d05;hb=5dec1c25713a19c49fcbb885200184a9682ef175;hp=6ed17ca16c655f24c5751eceb24becf17a1667cd;hpb=c798f7309337fc4c6dec7fd99d45cd76f809ab02;p=meshlink diff --git a/src/invitation.c b/src/invitation.c index 6ed17ca1..74987045 100644 --- a/src/invitation.c +++ b/src/invitation.c @@ -688,10 +688,6 @@ make_names: check_port(name); - fprintf(stderr, "Invitation succesfully accepted.\n"); - shutdown(sock, SHUT_RDWR); - success = true; - ask_netname: if(ask_netname) { fprintf(stderr, "Enter a new netname: "); @@ -720,6 +716,7 @@ ask_netname: return true; } + static bool invitation_send(void *handle, uint8_t type, const char *data, size_t len) { while(len) { int result = send(sock, data, len, 0); @@ -748,6 +745,12 @@ static bool invitation_receive(void *handle, uint8_t type, const char *msg, uint case 1: return finalize_join(); + case 2: + fprintf(stderr, "Invitation succesfully accepted.\n"); + shutdown(sock, SHUT_RDWR); + success = true; + break; + default: return false; }