Skip to content

Implement onNeighborListUpdated event #3076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ptesavol
Copy link
Collaborator

@ptesavol ptesavol commented Apr 21, 2025

  • Implement the neighborListUpdated event to be listened to by trackerless network users to detect changes in the neighbor list, the bufferedAmounts and upload and download rates of the neighbors to enable backpressure

Limitations:

  • only reports changes to bufferedAmount of BrowserWebRTC connections
  • Reports full NodeList contents to the onNeighborListUpdated event listeners, which might reveal too much information. Maybe in the future should implement a separate data interface that only contains the necessary data (upload and download rates etc.)?

@ptesavol ptesavol requested a review from juslesan April 21, 2025 20:31
Copy link

linear bot commented Apr 21, 2025

@github-actions github-actions bot added network Related to Network Package dht Related to DHT package labels Apr 21, 2025
@ptesavol ptesavol changed the title Implement onNeighborListChanged event Implement onNeighborListUpdated event Apr 22, 2025
@github-actions github-actions bot added test-utils Related to Test Utils Package cli-tools Related to CLI Tools Package utils proto-rpc sdk node labels Apr 22, 2025
@juslesan
Copy link
Contributor

juslesan commented May 2, 2025

Should fix the merge conflicts with the versioning in package.json files

…tachannels-to-the-users-of-trackerless-network
@github-actions github-actions bot removed test-utils Related to Test Utils Package cli-tools Related to CLI Tools Package utils proto-rpc sdk node labels May 2, 2025
@@ -17,6 +16,7 @@ export interface DiscoveryLayerNode {
off<T extends keyof DiscoveryLayerNodeEvents>(eventName: T, listener: () => void): void
once<T extends keyof DiscoveryLayerNodeEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor) => void): void
once<T extends keyof DiscoveryLayerNodeEvents>(eventName: T, listener: () => void): void

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unnecessary added line

@@ -53,10 +53,12 @@ export class NeighborUpdateManager {
const res = await this.createRemote(neighbor.getPeerDescriptor()).updateNeighbors(this.options.streamPartId, neighborDescriptors)
const nodeId = toNodeId(neighbor.getPeerDescriptor())
this.options.neighbors.get(nodeId)!.setRtt(Date.now() - startTime)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary adde lines in this file

this.currentBufferedAmount = bufferedAmountRemainder
// Update bufferedAmount in statistics but keep the upload rate the same
this.statistics.bufferedAmount = this.currentBufferedAmount
this.emit('statisticsUpdated', this.statistics)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this event end up being called quite often? Could there be some performance related if the bufferedAmount changes on each send

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The buffered amount should stay at 0 in normal operation, and be non-zero only if you are sending too fast. Maybe we should test this out with streamrtv by making a rc release of this branch?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I suppose it would make sense to do an internal release of these changes

@github-actions github-actions bot added test-utils Related to Test Utils Package cli-tools Related to CLI Tools Package utils proto-rpc sdk node labels May 16, 2025
@github-actions github-actions bot added the Stale label Jul 16, 2025
@github-actions github-actions bot closed this Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli-tools Related to CLI Tools Package dht Related to DHT package network Related to Network Package node proto-rpc sdk Stale test-utils Related to Test Utils Package utils
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants