jinroh / kadoh

The Kademlia DHT in Javascript for Node.js and Browsers
http://jinroh.github.com/kadoh
Other
242 stars 31 forks source link

Ping bug in debug UI ? #63

Closed garyhodgson closed 10 years ago

garyhodgson commented 10 years ago

Hi,

I'm running the udp DHT example ("bin/dht udp.default" and "jake run:udp") and I see that the ping function in the debug UI fails with the following exception:

Uncaught Error: Cannot find module '/dht/bootstrap-peer' KadOH.js?debug=true:41

I attempted to correct this with the following change:

control.js:101
-      var peer = new (require('/dht/bootstrap-peer'))(address);
+      var peer = new (require('/lib/dht/bootstrap-peer'))(address);

which seemed to work, but then exposed the following exception:

Uncaught TypeError: Object #<fn> has no method 'PING' control.js:102

My naieve attempt to fix this was to reference the PING RPCObject in the reactor object as follows:

control.js:102
-      var ping = that.node._reactor.PING(peer);
+      var ping = that.node._reactor.RPCObject.PING(peer);

but this appears not to return a deferrable:

Uncaught TypeError: Cannot call method 'then' of undefined control.js:103

Now I'm a bit lost how to proceed in order to fix this bug (which I would like to do to learn a bit more about the library, as I plan in using it in a p2p app.)

garyhodgson commented 10 years ago

A slight update. I was playing further and see that the deferrable can be obtained by calling new on the RPCObject, e.g.

var ping = new that.node._reactor.RPCObject.PING(peer);

However I am still not sure how to get this to work properly as the parameters do not seem to be set this way. Explicitly setting them on the resulting ping object doesn't appear to work either :(

Any hints would be appreciated.

alexstrat commented 10 years ago

Fixed by #65.