]> git.meshlink.io Git - meshlink/commitdiff
Let a server explicitly send a notification when the invitation protocol succeeded.
authorGuus Sliepen <guus@tinc-vpn.org>
Tue, 20 Aug 2013 20:36:31 +0000 (22:36 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Tue, 20 Aug 2013 20:36:31 +0000 (22:36 +0200)
src/invitation.c
src/protocol_auth.c

index 6ed17ca16c655f24c5751eceb24becf17a1667cd..749870458e61a7ec9f3292af831c9d2401bc6d05 100644 (file)
@@ -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;
        }
index f8a3cc3b3d2d3e5464263567189aab2b3beb8768..1623e75e4992307f0b460e78f66a8f870301c689 100644 (file)
@@ -174,6 +174,7 @@ static bool finalize_invitation(connection_t *c, const char *data, uint16_t len)
        fclose(f);
 
        logger(DEBUG_CONNECTIONS, LOG_INFO, "Key succesfully received from %s (%s)", c->name, c->hostname);
+       sptps_send_record(&c->sptps, 2, data, 0);
        return true;
 }