[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15703 - gnunet/src/core
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15703 - gnunet/src/core |
Date: |
Fri, 17 Jun 2011 17:39:24 +0200 |
Author: grothoff
Date: 2011-06-17 17:39:23 +0200 (Fri, 17 Jun 2011)
New Revision: 15703
Modified:
gnunet/src/core/core_api.c
gnunet/src/core/gnunet-service-core.c
gnunet/src/core/test_core_api_preferences.c
Log:
more error checks
Modified: gnunet/src/core/core_api.c
===================================================================
--- gnunet/src/core/core_api.c 2011-06-17 15:25:59 UTC (rev 15702)
+++ gnunet/src/core/core_api.c 2011-06-17 15:39:23 UTC (rev 15703)
@@ -417,17 +417,6 @@
GNUNET_CORE_PeerConfigurationInfoCallback pcic;
void *pcic_cls;
- if (NULL != (pcic = pr->pcic))
- {
- pcic_cls = pr->pcic_cls;
- GNUNET_CORE_peer_change_preference_cancel (pr->pcic_ptr);
- pcic (pcic_cls,
- &pr->peer,
- zero,
- 0,
- GNUNET_TIME_UNIT_FOREVER_REL,
- 0);
- }
if (pr->timeout_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_SCHEDULER_cancel (pr->timeout_task);
@@ -449,6 +438,18 @@
&pr->peer);
/* all requests should have been cancelled, clean up anyway, just in case */
GNUNET_break (pr->queue_size == 0);
+ if (NULL != (pcic = pr->pcic))
+ {
+ GNUNET_break (0);
+ pcic_cls = pr->pcic_cls;
+ GNUNET_CORE_peer_change_preference_cancel (pr->pcic_ptr);
+ pcic (pcic_cls,
+ &pr->peer,
+ zero,
+ 0,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ 0);
+ }
while (NULL != (th = pr->pending_head))
{
GNUNET_break (0);
@@ -460,6 +461,7 @@
th->cm->th = NULL;
GNUNET_free (th);
}
+ /* done with 'voluntary' cleanups, now on to normal freeing */
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_remove (h->peers,
key,
@@ -1512,6 +1514,7 @@
handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
}
GNUNET_CONTAINER_multihashmap_destroy (handle->peers);
+ handle->peers = NULL;
GNUNET_break (handle->ready_peer_head == NULL);
GNUNET_free (handle);
}
@@ -1942,7 +1945,7 @@
if (NULL == pr)
{
/* attempt to change preference on peer that is not connected */
- GNUNET_break (0);
+ GNUNET_assert (0);
return NULL;
}
if (pr->pcic != NULL)
Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c 2011-06-17 15:25:59 UTC (rev
15702)
+++ gnunet/src/core/gnunet-service-core.c 2011-06-17 15:39:23 UTC (rev
15703)
@@ -3883,6 +3883,7 @@
struct NotifyTrafficMessage *ntm;
struct GNUNET_TRANSPORT_ATS_Information *ats;
+ GNUNET_assert (GNUNET_YES == sender->is_connected);
if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
Modified: gnunet/src/core/test_core_api_preferences.c
===================================================================
--- gnunet/src/core/test_core_api_preferences.c 2011-06-17 15:25:59 UTC (rev
15702)
+++ gnunet/src/core/test_core_api_preferences.c 2011-06-17 15:39:23 UTC (rev
15703)
@@ -66,6 +66,8 @@
static struct GNUNET_CORE_InformationRequestContext *irc;
+static struct GNUNET_CORE_TransmitHandle *th;
+
static GNUNET_SCHEDULER_TaskIdentifier irc_task;
static GNUNET_SCHEDULER_TaskIdentifier ask_task;
@@ -99,9 +101,15 @@
#endif
GNUNET_break (0);
if (NULL != irc)
- GNUNET_CORE_peer_change_preference_cancel (irc);
+ {
+ GNUNET_CORE_peer_change_preference_cancel (irc);
+ irc = NULL;
+ }
if (GNUNET_SCHEDULER_NO_TASK != irc_task)
- GNUNET_SCHEDULER_cancel (irc_task);
+ {
+ GNUNET_SCHEDULER_cancel (irc_task);
+ irc_task = GNUNET_SCHEDULER_NO_TASK;
+ }
if (GNUNET_SCHEDULER_NO_TASK != ask_task)
{
GNUNET_SCHEDULER_cancel (ask_task);
@@ -121,6 +129,7 @@
struct PeerContext *p = cls;
struct GNUNET_MessageHeader *m;
+ th = NULL;
GNUNET_assert (ok == 4);
OKPP;
GNUNET_assert (p == &p1);
@@ -203,13 +212,13 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Asking core (1) for transmission to peer `%4s'\n",
GNUNET_i2s (&p2.id));
- if (NULL == GNUNET_CORE_notify_transmit_ready (p1.ch,
- GNUNET_YES,
- 0,
- GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 45),
- &p2.id,
- sizeof (struct
GNUNET_MessageHeader),
- &transmit_ready, &p1))
+ if (NULL == (th = GNUNET_CORE_notify_transmit_ready (p1.ch,
+ GNUNET_YES,
+ 0,
+
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 45),
+ &p2.id,
+ sizeof (struct
GNUNET_MessageHeader),
+ &transmit_ready, &p1)))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"RECEIVED NULL when asking core (1) for transmission to peer
`%4s'\n",
@@ -261,8 +270,27 @@
sizeof (struct GNUNET_PeerIdentity)))
return;
pc->connect_status = 0;
+ if (GNUNET_SCHEDULER_NO_TASK != irc_task)
+ {
+ GNUNET_SCHEDULER_cancel (irc_task);
+ irc_task = GNUNET_SCHEDULER_NO_TASK;
+ }
+ if (0 == memcmp (peer, &p1.id, sizeof (struct GNUNET_PeerIdentity)))
+ {
+ if (irc != NULL)
+ {
+ GNUNET_CORE_peer_change_preference_cancel (irc);
+ irc = NULL;
+ }
+ if (th != NULL)
+ {
+ GNUNET_CORE_notify_transmit_ready_cancel (th);
+ th = NULL;
+ }
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Encrypted connection to `%4s' cut\n", GNUNET_i2s (peer));
+ "Encrypted connection to `%4s' cut\n",
+ GNUNET_i2s (peer));
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15703 - gnunet/src/core,
gnunet <=