ssbc / ssb-lan

SSB plugin for discovery of other peers in the same LAN
MIT License
7 stars 1 forks source link

Tons of lan discoveries #1

Closed arj03 closed 5 years ago

arj03 commented 5 years ago

I wanted to use this module in patchbay and got it working but I noticed that I get quite a lot of lan-discoveries when I added a console.log to the pull.drain. How do you use it in manyverse?

staltz commented 5 years ago

@arj03 How do these discoveries look like? Are they from different peers or all from the same peer? And is it the "self" peer? I don't recall seeing this problem, and based on the codebase I can't predict why would it be doing this.

How do you use it in manyverse?

ssb-lan is not used directly, instead, ssb-conn handles discoveries in the scheduler:

https://github.com/staltz/ssb-conn/blob/2f88d690ecd984571dc6b8fdedca58e75c1f5c29/src/conn-scheduler.ts#L388-L412

arj03 commented 5 years ago

I'm seeing the same local peers over and over. I was tested this with 3 other machines and it seems like they come randomly from all of the peers. It's probably better to roll this into patchbay together with ssb-conn I think.

You put the discovered peers into "lan", but patchcore expects them to be in "local". Not necessarily a problem, just something to be aware of.

Thanks

staltz commented 5 years ago

You put the discovered peers into "lan", but patchcore expects them to be in "local". Not necessarily a problem, just something to be aware of.

You mean the "source" field? ssb-conn is compatible with legacy peers defined with "source", but is using the field "type" as the non-legacy one. The goal with that was to align the name ssb-lan with type="lan", and to avoid the name local which sounds like "device" sometimes. In Manyverse I try to look for source="local" or type="lan" and show both as Wi-Fi peers.

Back to this issue: what do you mean with "ton of discoveries"? Can you estimate how many "discoveries per second" are you seeing, for 3 local peers? It could be caused by double discovery (legacy mode and new mode), so 2 * 3 = 6 almost every second. So I think 6 discoveries/second would be rather normal rate.

arj03 commented 5 years ago

You mean the "source" field? ssb-conn is compatible with legacy peers defined with "source", but is using the field "type" as the non-legacy one.

Right, thanks

Back to this issue: what do you mean with "ton of discoveries"?

6 per second sounds about right. Just thought it was a bit much considering you might have a room with 20 people in it, but hopefully at that time we don't have to support legacy :)

Thank you so much for taking you time responding to these "questions", I'm really impressed with the quality of conn and lan and I'm looking forward to seeing them rolled out into clients.

staltz commented 5 years ago

Thanks!

6 per second sounds about right. Just thought it was a bit much considering you might have a room with 20 people in it, but hopefully at that time we don't have to support legacy :)

Yeah, and actually ssb-local broadcasts every 1sec while ssb-lan broadcasts every 2sec