projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
adding Ludo's gnunet-download-manager.scm back to SVN HEAD
[oweals/gnunet.git]
/
src
/
core
/
core_api.c
diff --git
a/src/core/core_api.c
b/src/core/core_api.c
index 57d01f6bb305557f15c729b3fb693fdd8fd2b47f..66df134fb1acaf7c5ace5f77f1f02c79a954bf14 100644
(file)
--- a/
src/core/core_api.c
+++ b/
src/core/core_api.c
@@
-421,7
+421,7
@@
disconnect_and_free_peer_entry (void *cls, const GNUNET_HashCode * key,
GNUNET_CONTAINER_multihashmap_remove (h->peers, key, pr));
GNUNET_assert (pr->pending_head == NULL);
GNUNET_assert (pr->pending_tail == NULL);
GNUNET_CONTAINER_multihashmap_remove (h->peers, key, pr));
GNUNET_assert (pr->pending_head == NULL);
GNUNET_assert (pr->pending_tail == NULL);
- GNUNET_assert (pr->ch = h);
+ GNUNET_assert (pr->ch =
=
h);
GNUNET_assert (pr->queue_size == 0);
GNUNET_assert (pr->timeout_task == GNUNET_SCHEDULER_NO_TASK);
GNUNET_assert (pr->ntr_task == GNUNET_SCHEDULER_NO_TASK);
GNUNET_assert (pr->queue_size == 0);
GNUNET_assert (pr->timeout_task == GNUNET_SCHEDULER_NO_TASK);
GNUNET_assert (pr->ntr_task == GNUNET_SCHEDULER_NO_TASK);
@@
-781,6
+781,7
@@
main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
const struct GNUNET_MessageHeader *em;
const struct SendMessageReady *smr;
const struct GNUNET_CORE_MessageHandler *mh;
const struct GNUNET_MessageHeader *em;
const struct SendMessageReady *smr;
const struct GNUNET_CORE_MessageHandler *mh;
+ const struct GNUNET_ATS_Information *ats;
GNUNET_CORE_StartupCallback init;
struct PeerRecord *pr;
struct GNUNET_CORE_TransmitHandle *th;
GNUNET_CORE_StartupCallback init;
struct PeerRecord *pr;
struct GNUNET_CORE_TransmitHandle *th;
@@
-851,7
+852,7
@@
main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
&h->me.hashPubKey, pr,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
if (NULL != h->connects)
&h->me.hashPubKey, pr,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
if (NULL != h->connects)
- h->connects (h->cls, &h->me, NULL);
+ h->connects (h->cls, &h->me, NULL
, 0
);
break;
case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT:
if (msize < sizeof (struct ConnectNotifyMessage))
break;
case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT:
if (msize < sizeof (struct ConnectNotifyMessage))
@@
-862,11
+863,9
@@
main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
}
cnm = (const struct ConnectNotifyMessage *) msg;
ats_count = ntohl (cnm->ats_count);
}
cnm = (const struct ConnectNotifyMessage *) msg;
ats_count = ntohl (cnm->ats_count);
- if ((msize !=
- sizeof (struct ConnectNotifyMessage) +
- ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)) ||
- (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR !=
- ntohl ((&cnm->ats)[ats_count].type)))
+ if (msize !=
+ sizeof (struct ConnectNotifyMessage) +
+ ats_count * sizeof (struct GNUNET_ATS_Information))
{
GNUNET_break (0);
reconnect_later (h);
{
GNUNET_break (0);
reconnect_later (h);
@@
-897,8
+896,9
@@
main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
GNUNET_CONTAINER_multihashmap_put (h->peers,
&cnm->peer.hashPubKey, pr,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
GNUNET_CONTAINER_multihashmap_put (h->peers,
&cnm->peer.hashPubKey, pr,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
+ ats = (const struct GNUNET_ATS_Information *) &cnm[1];
if (NULL != h->connects)
if (NULL != h->connects)
- h->connects (h->cls, &cnm->peer,
&cnm->ats
);
+ h->connects (h->cls, &cnm->peer,
ats, ats_count
);
break;
case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT:
if (msize != sizeof (struct DisconnectNotifyMessage))
break;
case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT:
if (msize != sizeof (struct DisconnectNotifyMessage))
@@
-945,10
+945,9
@@
main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
ats_count = ntohl (ntm->ats_count);
if ((msize <
sizeof (struct NotifyTrafficMessage) +
ats_count = ntohl (ntm->ats_count);
if ((msize <
sizeof (struct NotifyTrafficMessage) +
- ats_count * sizeof (struct GNUNET_
TRANSPORT_
ATS_Information) +
+ ats_count * sizeof (struct GNUNET_ATS_Information) +
sizeof (struct GNUNET_MessageHeader)) ||
sizeof (struct GNUNET_MessageHeader)) ||
- (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR !=
- ntohl ((&ntm->ats)[ats_count].type)))
+ (GNUNET_ATS_ARRAY_TERMINATOR != ntohl ((&ntm->ats)[ats_count].type)))
{
GNUNET_break (0);
reconnect_later (h);
{
GNUNET_break (0);
reconnect_later (h);
@@
-970,7
+969,7
@@
main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
if ((GNUNET_NO == h->inbound_hdr_only) &&
(msize !=
ntohs (em->size) + sizeof (struct NotifyTrafficMessage) +
if ((GNUNET_NO == h->inbound_hdr_only) &&
(msize !=
ntohs (em->size) + sizeof (struct NotifyTrafficMessage) +
- +ats_count * sizeof (struct GNUNET_
TRANSPORT_
ATS_Information)))
+ +ats_count * sizeof (struct GNUNET_ATS_Information)))
{
GNUNET_break (0);
reconnect_later (h);
{
GNUNET_break (0);
reconnect_later (h);
@@
-984,18
+983,22
@@
main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
continue;
if ((mh->expected_size != ntohs (em->size)) && (mh->expected_size != 0))
{
continue;
if ((mh->expected_size != ntohs (em->size)) && (mh->expected_size != 0))
{
- GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unexpected message size %u for message of type %u from peer `%4s'\n",
+ htons (em->size), mh->type, GNUNET_i2s (&ntm->peer));
+ GNUNET_break_op (0);
continue;
}
if (GNUNET_OK !=
continue;
}
if (GNUNET_OK !=
- h->handlers[hpos].callback (h->cls, &ntm->peer, em, &ntm->ats))
+ h->handlers[hpos].callback (h->cls, &ntm->peer, em, &ntm->ats,
+ ats_count))
{
/* error in processing, do not process other messages! */
break;
}
}
if (NULL != h->inbound_notify)
{
/* error in processing, do not process other messages! */
break;
}
}
if (NULL != h->inbound_notify)
- h->inbound_notify (h->cls, &ntm->peer, em, &ntm->ats);
+ h->inbound_notify (h->cls, &ntm->peer, em, &ntm->ats
, ats_count
);
break;
case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND:
if (msize < sizeof (struct NotifyTrafficMessage))
break;
case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND:
if (msize < sizeof (struct NotifyTrafficMessage))
@@
-1014,10
+1017,9
@@
main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
ats_count = ntohl (ntm->ats_count);
if ((msize <
sizeof (struct NotifyTrafficMessage) +
ats_count = ntohl (ntm->ats_count);
if ((msize <
sizeof (struct NotifyTrafficMessage) +
- ats_count * sizeof (struct GNUNET_
TRANSPORT_
ATS_Information) +
+ ats_count * sizeof (struct GNUNET_ATS_Information) +
sizeof (struct GNUNET_MessageHeader)) ||
sizeof (struct GNUNET_MessageHeader)) ||
- (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR !=
- ntohl ((&ntm->ats)[ats_count].type)))
+ (GNUNET_ATS_ARRAY_TERMINATOR != ntohl ((&ntm->ats)[ats_count].type)))
{
GNUNET_break (0);
reconnect_later (h);
{
GNUNET_break (0);
reconnect_later (h);
@@
-1039,7
+1041,7
@@
main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
if ((GNUNET_NO == h->outbound_hdr_only) &&
(msize !=
ntohs (em->size) + sizeof (struct NotifyTrafficMessage) +
if ((GNUNET_NO == h->outbound_hdr_only) &&
(msize !=
ntohs (em->size) + sizeof (struct NotifyTrafficMessage) +
- ats_count * sizeof (struct GNUNET_
TRANSPORT_
ATS_Information)))
+ ats_count * sizeof (struct GNUNET_ATS_Information)))
{
GNUNET_break (0);
reconnect_later (h);
{
GNUNET_break (0);
reconnect_later (h);
@@
-1050,7
+1052,7
@@
main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
GNUNET_break (0);
break;
}
GNUNET_break (0);
break;
}
- h->outbound_notify (h->cls, &ntm->peer, em, &ntm->ats);
+ h->outbound_notify (h->cls, &ntm->peer, em, &ntm->ats
, ats_count
);
break;
case GNUNET_MESSAGE_TYPE_CORE_SEND_READY:
if (msize != sizeof (struct SendMessageReady))
break;
case GNUNET_MESSAGE_TYPE_CORE_SEND_READY:
if (msize != sizeof (struct SendMessageReady))
@@
-1168,7
+1170,7
@@
reconnect (struct GNUNET_CORE_Handle *h)
init = (struct InitMessage *) &cm[1];
init->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_INIT);
init->header.size = htons (msize);
init = (struct InitMessage *) &cm[1];
init->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_INIT);
init->header.size = htons (msize);
- opt =
GNUNET_CORE_OPTION_SEND_CONNECT | GNUNET_CORE_OPTION_SEND_DISCONNECT
;
+ opt =
0
;
if (h->inbound_notify != NULL)
{
if (h->inbound_hdr_only)
if (h->inbound_notify != NULL)
{
if (h->inbound_hdr_only)
@@
-1421,15
+1423,12
@@
GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork,
GNUNET_free (minp);
}
GNUNET_free (minp);
}
- /* Order entries by deadline, but SKIP 'HEAD' if
- * we're in the 'ready_peer_*' DLL */
+ /* Order entries by deadline, but SKIP 'HEAD' (as we may have transmitted
+ * that request already or might even already be approved to transmit that
+ * message to core) */
pos = pr->pending_head;
pos = pr->pending_head;
- if ((pr->prev != NULL) || (pr->next != NULL) ||
- (pr == handle->ready_peer_head))
- {
- GNUNET_assert (pos != NULL);
+ if (pos != NULL)
pos = pos->next; /* skip head */
pos = pos->next; /* skip head */
- }
/* insertion sort */
prev = pos;
/* insertion sort */
prev = pos;