diff options
Diffstat (limited to 'src/core/core_api.c')
-rw-r--r-- | src/core/core_api.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c index 57c2932a2..f3f4cea54 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -781,7 +781,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
781 | const struct GNUNET_MessageHeader *em; | 781 | const struct GNUNET_MessageHeader *em; |
782 | const struct SendMessageReady *smr; | 782 | const struct SendMessageReady *smr; |
783 | const struct GNUNET_CORE_MessageHandler *mh; | 783 | const struct GNUNET_CORE_MessageHandler *mh; |
784 | const struct GNUNET_ATS_Information* ats; | 784 | const struct GNUNET_ATS_Information *ats; |
785 | GNUNET_CORE_StartupCallback init; | 785 | GNUNET_CORE_StartupCallback init; |
786 | struct PeerRecord *pr; | 786 | struct PeerRecord *pr; |
787 | struct GNUNET_CORE_TransmitHandle *th; | 787 | struct GNUNET_CORE_TransmitHandle *th; |
@@ -864,8 +864,8 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
864 | cnm = (const struct ConnectNotifyMessage *) msg; | 864 | cnm = (const struct ConnectNotifyMessage *) msg; |
865 | ats_count = ntohl (cnm->ats_count); | 865 | ats_count = ntohl (cnm->ats_count); |
866 | if (msize != | 866 | if (msize != |
867 | sizeof (struct ConnectNotifyMessage) + | 867 | sizeof (struct ConnectNotifyMessage) + |
868 | ats_count * sizeof (struct GNUNET_ATS_Information)) | 868 | ats_count * sizeof (struct GNUNET_ATS_Information)) |
869 | { | 869 | { |
870 | GNUNET_break (0); | 870 | GNUNET_break (0); |
871 | reconnect_later (h); | 871 | reconnect_later (h); |
@@ -896,11 +896,9 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
896 | GNUNET_CONTAINER_multihashmap_put (h->peers, | 896 | GNUNET_CONTAINER_multihashmap_put (h->peers, |
897 | &cnm->peer.hashPubKey, pr, | 897 | &cnm->peer.hashPubKey, pr, |
898 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); | 898 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); |
899 | ats = (const struct GNUNET_ATS_Information*) &cnm[1]; | 899 | ats = (const struct GNUNET_ATS_Information *) &cnm[1]; |
900 | if (NULL != h->connects) | 900 | if (NULL != h->connects) |
901 | h->connects (h->cls, &cnm->peer, | 901 | h->connects (h->cls, &cnm->peer, ats, ats_count); |
902 | ats, | ||
903 | ats_count); | ||
904 | break; | 902 | break; |
905 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT: | 903 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT: |
906 | if (msize != sizeof (struct DisconnectNotifyMessage)) | 904 | if (msize != sizeof (struct DisconnectNotifyMessage)) |
@@ -949,8 +947,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
949 | sizeof (struct NotifyTrafficMessage) + | 947 | sizeof (struct NotifyTrafficMessage) + |
950 | ats_count * sizeof (struct GNUNET_ATS_Information) + | 948 | ats_count * sizeof (struct GNUNET_ATS_Information) + |
951 | sizeof (struct GNUNET_MessageHeader)) || | 949 | sizeof (struct GNUNET_MessageHeader)) || |
952 | (GNUNET_ATS_ARRAY_TERMINATOR != | 950 | (GNUNET_ATS_ARRAY_TERMINATOR != ntohl ((&ntm->ats)[ats_count].type))) |
953 | ntohl ((&ntm->ats)[ats_count].type))) | ||
954 | { | 951 | { |
955 | GNUNET_break (0); | 952 | GNUNET_break (0); |
956 | reconnect_later (h); | 953 | reconnect_later (h); |
@@ -986,23 +983,22 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
986 | continue; | 983 | continue; |
987 | if ((mh->expected_size != ntohs (em->size)) && (mh->expected_size != 0)) | 984 | if ((mh->expected_size != ntohs (em->size)) && (mh->expected_size != 0)) |
988 | { | 985 | { |
989 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 986 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
990 | "Unexpected message size for message of type %u\n", | 987 | "Unexpected message size for message of type %u\n", |
991 | mh->type); | 988 | mh->type); |
992 | GNUNET_break_op (0); | 989 | GNUNET_break_op (0); |
993 | continue; | 990 | continue; |
994 | } | 991 | } |
995 | if (GNUNET_OK != | 992 | if (GNUNET_OK != |
996 | h->handlers[hpos].callback (h->cls, &ntm->peer, em, &ntm->ats, | 993 | h->handlers[hpos].callback (h->cls, &ntm->peer, em, &ntm->ats, |
997 | ats_count)) | 994 | ats_count)) |
998 | { | 995 | { |
999 | /* error in processing, do not process other messages! */ | 996 | /* error in processing, do not process other messages! */ |
1000 | break; | 997 | break; |
1001 | } | 998 | } |
1002 | } | 999 | } |
1003 | if (NULL != h->inbound_notify) | 1000 | if (NULL != h->inbound_notify) |
1004 | h->inbound_notify (h->cls, &ntm->peer, em, &ntm->ats, | 1001 | h->inbound_notify (h->cls, &ntm->peer, em, &ntm->ats, ats_count); |
1005 | ats_count); | ||
1006 | break; | 1002 | break; |
1007 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND: | 1003 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND: |
1008 | if (msize < sizeof (struct NotifyTrafficMessage)) | 1004 | if (msize < sizeof (struct NotifyTrafficMessage)) |
@@ -1023,8 +1019,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
1023 | sizeof (struct NotifyTrafficMessage) + | 1019 | sizeof (struct NotifyTrafficMessage) + |
1024 | ats_count * sizeof (struct GNUNET_ATS_Information) + | 1020 | ats_count * sizeof (struct GNUNET_ATS_Information) + |
1025 | sizeof (struct GNUNET_MessageHeader)) || | 1021 | sizeof (struct GNUNET_MessageHeader)) || |
1026 | (GNUNET_ATS_ARRAY_TERMINATOR != | 1022 | (GNUNET_ATS_ARRAY_TERMINATOR != ntohl ((&ntm->ats)[ats_count].type))) |
1027 | ntohl ((&ntm->ats)[ats_count].type))) | ||
1028 | { | 1023 | { |
1029 | GNUNET_break (0); | 1024 | GNUNET_break (0); |
1030 | reconnect_later (h); | 1025 | reconnect_later (h); |