diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-04-23 09:46:25 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-04-23 09:46:25 +0000 |
commit | b03c1fcb8458283526af2ef15f8dab7edf7c14f8 (patch) | |
tree | 3d87a7670c1fa32bfeb334ad5ce194e68d6309d5 /src | |
parent | 597e676a39da448348164042bb0e0b1f9b957c40 (diff) | |
download | gnunet-b03c1fcb8458283526af2ef15f8dab7edf7c14f8.tar.gz gnunet-b03c1fcb8458283526af2ef15f8dab7edf7c14f8.zip |
peerinfo
Diffstat (limited to 'src')
-rw-r--r-- | src/peerinfo-tool/gnunet-peerinfo.c | 24 | ||||
-rwxr-xr-x | src/peerinfo-tool/test_gnunet_peerinfo.py | 16 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c index ba6609596..ba9832099 100644 --- a/src/peerinfo-tool/gnunet-peerinfo.c +++ b/src/peerinfo-tool/gnunet-peerinfo.c | |||
@@ -228,9 +228,33 @@ run (void *cls, | |||
228 | struct GNUNET_PeerIdentity pid; | 228 | struct GNUNET_PeerIdentity pid; |
229 | struct GNUNET_CRYPTO_HashAsciiEncoded enc; | 229 | struct GNUNET_CRYPTO_HashAsciiEncoded enc; |
230 | char *fn; | 230 | char *fn; |
231 | int delta; | ||
231 | 232 | ||
232 | sched = s; | 233 | sched = s; |
233 | cfg = c; | 234 | cfg = c; |
235 | delta = 0; | ||
236 | if ( (args[0] != NULL) && | ||
237 | (args[1] != NULL) && | ||
238 | (1 == sscanf(args[0], "%d", &delta)) && | ||
239 | (GNUNET_OK == | ||
240 | GNUNET_CRYPTO_hash_from_string (args[1], | ||
241 | &pid.hashPubKey)) ) | ||
242 | { | ||
243 | peerinfo = GNUNET_PEERINFO_connect (sched, cfg); | ||
244 | GNUNET_PEERINFO_iterate (peerinfo, | ||
245 | &pid, | ||
246 | delta, | ||
247 | GNUNET_TIME_UNIT_SECONDS, | ||
248 | &print_peer_info, NULL); | ||
249 | return; | ||
250 | } | ||
251 | else if (args[0] != NULL) | ||
252 | { | ||
253 | fprintf (stderr, | ||
254 | _("Invalid command line argument `%s'\n"), | ||
255 | args[0]); | ||
256 | return; | ||
257 | } | ||
234 | if (get_self != GNUNET_YES) | 258 | if (get_self != GNUNET_YES) |
235 | { | 259 | { |
236 | peerinfo = GNUNET_PEERINFO_connect (sched, cfg); | 260 | peerinfo = GNUNET_PEERINFO_connect (sched, cfg); |
diff --git a/src/peerinfo-tool/test_gnunet_peerinfo.py b/src/peerinfo-tool/test_gnunet_peerinfo.py index 3aa8497af..e9881a7b6 100755 --- a/src/peerinfo-tool/test_gnunet_peerinfo.py +++ b/src/peerinfo-tool/test_gnunet_peerinfo.py | |||
@@ -38,6 +38,11 @@ try: | |||
38 | pinfo.expect (re.compile (".......................................................................................................\r")); | 38 | pinfo.expect (re.compile (".......................................................................................................\r")); |
39 | pinfo.expect (pexpect.EOF); | 39 | pinfo.expect (pexpect.EOF); |
40 | 40 | ||
41 | pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf invalid') | ||
42 | pinfo.expect (re.compile ("Invalid command line argument `invalid\'\r")); | ||
43 | pinfo.expect (pexpect.EOF); | ||
44 | |||
45 | |||
41 | os.system ('gnunet-arm -q -i transport -c test_gnunet_peerinfo_data.conf') | 46 | os.system ('gnunet-arm -q -i transport -c test_gnunet_peerinfo_data.conf') |
42 | 47 | ||
43 | pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf') | 48 | pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf') |
@@ -50,6 +55,17 @@ try: | |||
50 | pinfo.expect (re.compile (" *127.0.0.1:24357\r")); | 55 | pinfo.expect (re.compile (" *127.0.0.1:24357\r")); |
51 | pinfo.expect (pexpect.EOF); | 56 | pinfo.expect (pexpect.EOF); |
52 | 57 | ||
58 | pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -qs') | ||
59 | pid = pinfo.read (-1) | ||
60 | pid = pid.strip () | ||
61 | |||
62 | pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf 4 ' + pid) | ||
63 | pinfo.expect (re.compile ("Peer `" + pid + "\' with trust *4\r")); | ||
64 | pinfo.expect (pexpect.EOF); | ||
65 | |||
66 | pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -- -4 ' + pid) | ||
67 | pinfo.expect (re.compile ("Peer `" + pid + "\' with trust *0\r")); | ||
68 | pinfo.expect (pexpect.EOF); | ||
53 | 69 | ||
54 | finally: | 70 | finally: |
55 | os.system ('gnunet-arm -c test_gnunet_peerinfo_data.conf -eq') | 71 | os.system ('gnunet-arm -c test_gnunet_peerinfo_data.conf -eq') |