gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r33233 - in gnunet-python: . gnunet


From: gnunet
Subject: [GNUnet-SVN] r33233 - in gnunet-python: . gnunet
Date: Sun, 11 May 2014 04:54:29 +0200

Author: canndrew
Date: 2014-05-11 04:54:29 +0200 (Sun, 11 May 2014)
New Revision: 33233

Added:
   gnunet-python/.gitignore
Modified:
   gnunet-python/example-dht.py
   gnunet-python/gnunet/__init__.py
   gnunet-python/gnunet/dht.py
Log:
Added filter_known_results, stop functions to dht. Bug fixes.

Added: gnunet-python/.gitignore
===================================================================
--- gnunet-python/.gitignore                            (rev 0)
+++ gnunet-python/.gitignore    2014-05-11 02:54:29 UTC (rev 33233)
@@ -0,0 +1,4 @@
+*.swp
+*.swo
+/gnunet/__pycache__
+

Modified: gnunet-python/example-dht.py
===================================================================
--- gnunet-python/example-dht.py        2014-05-10 15:35:50 UTC (rev 33232)
+++ gnunet-python/example-dht.py        2014-05-11 02:54:29 UTC (rev 33233)
@@ -16,7 +16,9 @@
   print("  put_path   == %s" % repr(put_path))
   print("  data       == %s" % repr(data))
 
-gnunet.dht.get_start(result_callback, "test", key, 1, record_route=True)
+req = gnunet.dht.get_start(result_callback, "test", key, 1, record_route=True)
+req.filter_known_results([])
+req.stop()
 
 time.sleep(1)
 

Modified: gnunet-python/gnunet/__init__.py
===================================================================
--- gnunet-python/gnunet/__init__.py    2014-05-10 15:35:50 UTC (rev 33232)
+++ gnunet-python/gnunet/__init__.py    2014-05-11 02:54:29 UTC (rev 33233)
@@ -6,7 +6,7 @@
 class _Key:
   def __init__(self, arg, subtype, bits):
     if isinstance(arg, subtype):
-      self._data = arg.data
+      self._data = arg._data
     elif isinstance(arg, str):
       self._data = strings.string_to_data(arg)
     else:

Modified: gnunet-python/gnunet/dht.py
===================================================================
--- gnunet-python/gnunet/dht.py 2014-05-10 15:35:50 UTC (rev 33232)
+++ gnunet-python/gnunet/dht.py 2014-05-11 02:54:29 UTC (rev 33233)
@@ -51,6 +51,19 @@
     self.callback = callback
     self.record_route = record_route
 
+  def filter_known_results(self, keys):
+    keys = dbus.Array([dbusize(HashCode(key)) for key in list(keys)], 
signature="v")
+    try:
+      sysbus.get_object("gnu.gnunet.dht", 
self._path).filter_known_results(keys, dbus_interface="gnu.gnunet.dht.get")
+    except dbus.DBusException as e:
+      handle_exception(e, "dht", "gnu.gnunet.dht")
+
+  def stop(self):
+    try:
+      sysbus.get_object("gnu.gnunet.dht", 
self._path).stop(dbus_interface="gnu.gnunet.dht.get")
+    except dbus.DBusException as e:
+      handle_exception(e, "dht", "gnu.gnunet.dht")
+
 def put(key, desired_replication_level, block_type, data, expiry=None, 
demultiplex_everywhere=False, record_route=False, bart=False):
   key = dbusize(HashCode(key), True)
   desired_replication_level = dbus.UInt32(desired_replication_level)




reply via email to

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