[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r7650 - in GNUnet: . src/applications/identity src/include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r7650 - in GNUnet: . src/applications/identity src/include src/server |
Date: |
Mon, 1 Sep 2008 01:12:18 -0600 (MDT) |
Author: grothoff
Date: 2008-09-01 01:12:18 -0600 (Mon, 01 Sep 2008)
New Revision: 7650
Modified:
GNUnet/src/applications/identity/identity.c
GNUnet/src/applications/identity/identitytest.c
GNUnet/src/include/gnunet_identity_service.h
GNUnet/src/server/gnunet-peer-info.c
GNUnet/todo
Log:
undo -- my bad
Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2008-09-01 03:03:34 UTC (rev
7649)
+++ GNUnet/src/applications/identity/identity.c 2008-09-01 07:12:18 UTC (rev
7650)
@@ -263,28 +263,22 @@
change_host_trust (const GNUNET_PeerIdentity * hostId, int value)
{
HostEntry *host;
-
+
if (value == 0)
return 0;
-
GNUNET_mutex_lock (lock_);
host = lookup_host_entry (hostId);
if (host == NULL)
{
- if (value == 0)
- {
- GNUNET_mutex_unlock (lock_);
- return 0;
- }
add_host_to_known_hosts (hostId, GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT);
host = lookup_host_entry (hostId);
- if (host == NULL)
- {
- GNUNET_GE_BREAK (ectx, 0);
- GNUNET_mutex_unlock (lock_);
- return 0;
- }
}
+ if (host == NULL)
+ {
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_mutex_unlock (lock_);
+ return 0;
+ }
if (((int) (host->trust & TRUST_ACTUAL_MASK)) + value < 0)
{
value = -(host->trust & TRUST_ACTUAL_MASK);
@@ -300,6 +294,30 @@
}
/**
+ * Get the amount of trust we have in a host.
+ *
+ * @param hostId is the identity of the host
+ * @returns trust we have in the host (-1 on error)
+ */
+static int
+get_host_trust (const GNUNET_PeerIdentity * hostId)
+{
+ HostEntry *host;
+ int value;
+
+ GNUNET_mutex_lock (lock_);
+ host = lookup_host_entry (hostId);
+ if (host == NULL)
+ {
+ GNUNET_mutex_unlock (lock_);
+ return 0;
+ }
+ value = ((int) (host->trust & TRUST_ACTUAL_MASK));
+ GNUNET_mutex_unlock (lock_);
+ return value;
+}
+
+/**
* Remove a file that should not be there. LOG
* success or failure.
*/
Modified: GNUnet/src/applications/identity/identitytest.c
===================================================================
--- GNUnet/src/applications/identity/identitytest.c 2008-09-01 03:03:34 UTC
(rev 7649)
+++ GNUnet/src/applications/identity/identitytest.c 2008-09-01 07:12:18 UTC
(rev 7650)
@@ -77,19 +77,19 @@
pid = hello->senderIdentity;
GNUNET_free (hello);
- identity->changeHostTrust (&pid, -identity->changeHostTrust (&pid, 0));
+ identity->changeHostTrust (&pid, -identity->getHostTrust (&pid));
ASSERT (4 == identity->changeHostTrust (&pid, 4));
GNUNET_CORE_release_service (identity);
identity = GNUNET_CORE_request_service ("identity");
- ASSERT (4 == identity->changeHostTrust (&pid, 0));
+ ASSERT (4 == identity->getHostTrust (&pid));
ASSERT (5 == identity->changeHostTrust (&pid, 5));
ASSERT (-2 == identity->changeHostTrust (&pid, -2));
- ASSERT (7 == identity->changeHostTrust (&pid, 0));
+ ASSERT (7 == identity->getHostTrust (&pid));
ASSERT (-7 == identity->changeHostTrust (&pid, -40));
pkey = identity->getPublicPrivateKey ();
identity->getPeerIdentity (pkey, &pid);
- ASSERT (0 == identity->changeHostTrust (&pid, 0));
+ ASSERT (0 == identity->getHostTrust (&pid));
pkey = identity->getPublicPrivateKey ();
ASSERT (GNUNET_OK == identity->signData ("TestData", 8, &sig));
Modified: GNUnet/src/include/gnunet_identity_service.h
===================================================================
--- GNUnet/src/include/gnunet_identity_service.h 2008-09-01 03:03:34 UTC
(rev 7649)
+++ GNUnet/src/include/gnunet_identity_service.h 2008-09-01 07:12:18 UTC
(rev 7650)
@@ -209,6 +209,14 @@
*/
int (*changeHostTrust) (const GNUNET_PeerIdentity * hostId, int value);
+ /**
+ * Get the amount of trust we have in a host.
+ *
+ * @param hostId is the identity of the host
+ * @returns trust we have in the host (-1 on error)
+ */
+ int (*getHostTrust) (const GNUNET_PeerIdentity * hostId);
+
} GNUNET_Identity_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/server/gnunet-peer-info.c
===================================================================
--- GNUnet/src/server/gnunet-peer-info.c 2008-09-01 03:03:34 UTC (rev
7649)
+++ GNUnet/src/server/gnunet-peer-info.c 2008-09-01 07:12:18 UTC (rev
7650)
@@ -166,14 +166,14 @@
printf ("%s\n", (char *) &enc);
else
printf (_("Peer `%s' with trust %8u\n"),
- (char *) &enc, identity->changeHostTrust (id, 0));
+ (char *) &enc, identity->getHostTrust (id));
return GNUNET_OK;
}
if (be_quiet)
printf ("%s\n", (char *) &enc);
else
printf (_("Peer `%s' with trust %8u and address `%s'\n"),
- (char *) &enc, identity->changeHostTrust (id, 0), info);
+ (char *) &enc, identity->getHostTrust (id), info);
GNUNET_free (info);
return GNUNET_OK;
}
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2008-09-01 03:03:34 UTC (rev 7649)
+++ GNUnet/todo 2008-09-01 07:12:18 UTC (rev 7650)
@@ -1,6 +1,9 @@
This is just the current plan, plans change.
0.8.1 [8'08] (aka "growth"):
+- test extended config API
+- fix gnunet-auto-share
+
- Publishing:
* clean up indexing with gnunet-insert (#1107)
* power insert (#854)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r7650 - in GNUnet: . src/applications/identity src/include src/server,
gnunet <=