diff options
Diffstat (limited to 'src/peerinfo/gnunet-service-peerinfo.c')
-rw-r--r-- | src/peerinfo/gnunet-service-peerinfo.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index aa2047c7c..1802da959 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c | |||
@@ -29,6 +29,8 @@ | |||
29 | * | 29 | * |
30 | * TODO: | 30 | * TODO: |
31 | * - HostEntries are never 'free'd (add expiration, upper bound?) | 31 | * - HostEntries are never 'free'd (add expiration, upper bound?) |
32 | * - AddPeer message is obsolete with NEW peerinfo API (remove handler, | ||
33 | * message struct and protocol) | ||
32 | */ | 34 | */ |
33 | 35 | ||
34 | #include "platform.h" | 36 | #include "platform.h" |
@@ -684,6 +686,33 @@ handle_add (void *cls, | |||
684 | 686 | ||
685 | 687 | ||
686 | /** | 688 | /** |
689 | * Handle HELLO-message. | ||
690 | * | ||
691 | * @param cls closure | ||
692 | * @param client identification of the client | ||
693 | * @param message the actual message | ||
694 | */ | ||
695 | static void | ||
696 | handle_hello (void *cls, | ||
697 | struct GNUNET_SERVER_Client *client, | ||
698 | const struct GNUNET_MessageHeader *message) | ||
699 | { | ||
700 | const struct GNUNET_HELLO_Message *hello; | ||
701 | struct GNUNET_PeerIdentity pid; | ||
702 | |||
703 | hello = (const struct GNUNET_HELLO_Message *) message; | ||
704 | if (GNUNET_OK != GNUNET_HELLO_get_id (hello, &pid)) | ||
705 | { | ||
706 | GNUNET_break (0); | ||
707 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
708 | return; | ||
709 | } | ||
710 | bind_address (&pid, hello); | ||
711 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | ||
712 | } | ||
713 | |||
714 | |||
715 | /** | ||
687 | * Handle GET-message. | 716 | * Handle GET-message. |
688 | * | 717 | * |
689 | * @param cls closure | 718 | * @param cls closure |
@@ -757,6 +786,7 @@ handle_notify (void *cls, | |||
757 | * service. | 786 | * service. |
758 | */ | 787 | */ |
759 | static struct GNUNET_SERVER_MessageHandler handlers[] = { | 788 | static struct GNUNET_SERVER_MessageHandler handlers[] = { |
789 | {&handle_hello, NULL, GNUNET_MESSAGE_TYPE_HELLO, 0}, | ||
760 | {&handle_add, NULL, GNUNET_MESSAGE_TYPE_PEERINFO_ADD, 0}, | 790 | {&handle_add, NULL, GNUNET_MESSAGE_TYPE_PEERINFO_ADD, 0}, |
761 | {&handle_get, NULL, GNUNET_MESSAGE_TYPE_PEERINFO_GET, | 791 | {&handle_get, NULL, GNUNET_MESSAGE_TYPE_PEERINFO_GET, |
762 | sizeof (struct ListPeerMessage)}, | 792 | sizeof (struct ListPeerMessage)}, |