-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Conversation
293bcf9
to
0dba866
Compare
|
||
for (let i = 0; i < count; i++) { | ||
argv.ipfs.ping(peerId, pingCb) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A ping with count 10 is a ping with 10 packets, not 10 ping calls. You need to count the number of pings that come in p.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that 10 ping calls is wrong. I started refactoring the code and was able to use the ping object and stream the times to the api.
But I have run into a problem. In js-ipfs-api the response assumes there will be one ping request.
So even if I stream multiple ping responses only the first one is returned.
My understanding of the flow when someone types jsipfs ping is
- cli/commands/ping.js -> this calls the ipfs-api ping
- node_modules/ipfs-api/src/ping.js -> this calls the http api ping
- http/api/resources/ping.js -> this calls the component ping
- core/components/ping.js which would then return the ping object
- http/api/resources/ping.js would then stream the times to the ipfs-api and end the stream when number of pings are complete.
The problem is js-ipfs-api is expecting only one response ping object. Is there a workaround I'm missing or should I create an issue inn js-ipfs-api ping and fix that. I just want to confirm whether you its an issue or not. :)
Also, irrespective of the api I was able to get the curl outputs for both the go-ipfs http api and js-ipfs http api to be the same . I have attached images for the same. But again I find one inconsistency . Since we are using new Date() in js-libp2p-ping we are not getting the same unit as go-ipfs. go-ipfs returns in nanosecond and js-ipfs returns the time in milliseconds. Let me know whether I should create a issue and fix that. I would be glad to do it. I just want to confirm whether its an issue or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a workaround I'm missing or should I create an issue inn js-ipfs-api ping and fix that.
Sounds like it needs to be fixed in js-ipfs-api then. Just go for it too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that @ngotchac noticed a misbehavior a while ago too ipfs-inactive/js-ipfs-http-client#556
@melvin0008 still looking into finishing this PR? |
@diasdavid Yes will do it the coming weekend. Sorry for the wait |
Let's coalesce the energies here on #1299 |
Attempt to solve #928
@diasdavid Let me know your thoughts on the same