gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r11055 - in gnunet: doc/man src/peerinfo-tool


From: gnunet
Subject: [GNUnet-SVN] r11055 - in gnunet: doc/man src/peerinfo-tool
Date: Fri, 23 Apr 2010 11:46:25 +0200

Author: grothoff
Date: 2010-04-23 11:46:25 +0200 (Fri, 23 Apr 2010)
New Revision: 11055

Modified:
   gnunet/doc/man/gnunet-peerinfo.1
   gnunet/src/peerinfo-tool/gnunet-peerinfo.c
   gnunet/src/peerinfo-tool/test_gnunet_peerinfo.py
Log:
peerinfo

Modified: gnunet/doc/man/gnunet-peerinfo.1
===================================================================
--- gnunet/doc/man/gnunet-peerinfo.1    2010-04-23 09:46:14 UTC (rev 11054)
+++ gnunet/doc/man/gnunet-peerinfo.1    2010-04-23 09:46:25 UTC (rev 11055)
@@ -10,7 +10,7 @@
 
 .SH DESCRIPTION
 .PP
-\fBgnunet\-peerinfo\fP display the known addresses and trust of known peers.
+\fBgnunet\-peerinfo\fP display the known addresses and trust of known peers.  
The tool can also be used to change the amount of trust we have in another 
peer.  For this, the options should be first the amount of trust changed 
(prefix it with "\-\- " if the amount is negative) followed by the peer 
identity.
 
 .SH OPTIONS
 .B
@@ -35,8 +35,19 @@
 .IP "\-L LOGLEVEL, \-\-loglelvel=LOGLEVEL"
 Set the loglevel
 
+.SH EXAMPLE
+.TP
+gnunet\-peerinfo 4 
S9LBDF6V770H8CELVKBFJMOTS25LB272JB81MRJHSRJI9B1FBVOSGJVSEIRIS5J4SRDU4HT3TBPLM4MNEND7FFUHMGCK4NBR8R2UTSG
+Increase the trust in a peer by 4
+.TP
+gnunet\-peerinfo \-\- \-2 
S9LBDF6V770H8CELVKBFJMOTS25LB272JB81MRJHSRJI9B1FBVOSGJVSEIRIS5J4SRDU4HT3TBPLM4MNEND7FFUHMGCK4NBR8R2UTSG
+Decrease the trust in a peer by 2
+
+
+
+
 .SH BUGS
-Report bugs by using mantis <https://gnunet.org/mantis/> or by sending 
electronic mail to <address@hidden>
+Report bugs by using mantis <https://gnunet.org/bugs/> or by sending 
electronic mail to <address@hidden>
 
 .SH SEE ALSO
 gnunet.conf(5)

Modified: gnunet/src/peerinfo-tool/gnunet-peerinfo.c
===================================================================
--- gnunet/src/peerinfo-tool/gnunet-peerinfo.c  2010-04-23 09:46:14 UTC (rev 
11054)
+++ gnunet/src/peerinfo-tool/gnunet-peerinfo.c  2010-04-23 09:46:25 UTC (rev 
11055)
@@ -228,9 +228,33 @@
   struct GNUNET_PeerIdentity pid;
   struct GNUNET_CRYPTO_HashAsciiEncoded enc;
   char *fn;
+  int delta;
 
   sched = s;
   cfg = c;
+  delta = 0;
+  if ( (args[0] != NULL) &&
+       (args[1] != NULL) &&
+       (1 == sscanf(args[0], "%d", &delta)) &&
+       (GNUNET_OK == 
+       GNUNET_CRYPTO_hash_from_string (args[1],
+                                       &pid.hashPubKey)) )
+    {
+      peerinfo = GNUNET_PEERINFO_connect (sched, cfg);
+      GNUNET_PEERINFO_iterate (peerinfo,
+                              &pid,
+                              delta,
+                              GNUNET_TIME_UNIT_SECONDS,
+                              &print_peer_info, NULL);                         
   
+      return;
+    }
+  else if (args[0] != NULL)
+    {
+      fprintf (stderr,
+              _("Invalid command line argument `%s'\n"),
+              args[0]);
+      return;    
+    }
   if (get_self != GNUNET_YES)
     {
       peerinfo = GNUNET_PEERINFO_connect (sched, cfg);

Modified: gnunet/src/peerinfo-tool/test_gnunet_peerinfo.py
===================================================================
--- gnunet/src/peerinfo-tool/test_gnunet_peerinfo.py    2010-04-23 09:46:14 UTC 
(rev 11054)
+++ gnunet/src/peerinfo-tool/test_gnunet_peerinfo.py    2010-04-23 09:46:25 UTC 
(rev 11055)
@@ -38,6 +38,11 @@
   pinfo.expect (re.compile 
(".......................................................................................................\r"));
   pinfo.expect (pexpect.EOF);
 
+  pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf 
invalid')
+  pinfo.expect (re.compile ("Invalid command line argument `invalid\'\r"));
+  pinfo.expect (pexpect.EOF);
+
+
   os.system ('gnunet-arm -q -i transport -c test_gnunet_peerinfo_data.conf')
 
   pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf')
@@ -50,7 +55,18 @@
   pinfo.expect (re.compile (" *127.0.0.1:24357\r"));
   pinfo.expect (pexpect.EOF);
 
+  pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf 
-qs')
+  pid = pinfo.read (-1)
+  pid = pid.strip ()
 
+  pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf 4 
' + pid)
+  pinfo.expect (re.compile ("Peer `" + pid + "\' with trust  *4\r"));
+  pinfo.expect (pexpect.EOF);  
+
+  pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -- 
-4 ' + pid)
+  pinfo.expect (re.compile ("Peer `" + pid + "\' with trust  *0\r"));
+  pinfo.expect (pexpect.EOF);  
+
 finally:
   os.system ('gnunet-arm -c test_gnunet_peerinfo_data.conf -eq')
   os.system ('rm -rf /tmp/gnunet-test-peerinfo/')





reply via email to

[Prev in Thread] Current Thread [Next in Thread]