Skip to content

Introduce CORES packages for Ping and PingResponse #585

Open
@dnwiebe

Description

@dnwiebe

After this card was written, it was determined that we want latency to apply to links between Nodes, not to Nodes themselves. Somebody needs to go through this card and change the language to reflect that before it's played.

As of the writing of this card, there are five structures that can inhabit a CORES package:

Gossip_0v1
NodeRecordInner_0v1 (this is cheating, kind of; see below)
DnsResolveFailure_0v1
ClientRequestPayload_0v1
ClientResponsePayload_0v1

NodeRecordInner_0v1 doesn't completely count because it doesn't go directly inside a CORES package; it goes inside a Gossip_0v1.

But we need to add two more, and code to handle them.

One should be a Ping-like packet that is routed to a target Node just as if it were a ClientRequestPayload_0v1 (this routing logic will be enhanced later, but for this card we should just use the existing routing_engine). When a Node receives one of these Ping-like packets, it should instantly--as quickly as possible, because latency is what we're measuring--send back a Ping response to the originating Node.

Eventually, there'll be a card for figuring out when and where to send a Ping message. For now, put in temporary code that arranges to Ping a Node whenever it shows up for the first time in the Neighborhood, unless it has Debuted directly to us or we have Debuted directly to it. Mark the code so that it can be easily located and removed later.

When an originating Node receives a Ping response, it should look up the information it saved about the Ping request and compute a latency figure, which it should log to the logfile. (Eventually we will do more productive things with the latency figure; for the moment we'll just log it.) After computing and logging the latency, the originating Node should discard its record of the Ping request.

If an originating Node receives a Ping response that it did not solicit, it should log a warning and discard the response.

Periodically, perhaps as part of some periodic logic that already exists, the Node should scan its pending Ping requests to find all those older than some reasonable limit (a minute?) and discard them.

Note: If this card is played after Reversal Mode is implemented, it should be possible to use only a single new structure, not both a Ping and a response, by having the target Node switch the Ping into reversal mode and send it back. This might actually be preferable; we should consider delaying this card until after Reversal Mode.

Another Note: Don't put a timestamp in the Ping packet or its response. On the one hand, timestamps don't mean much when other Nodes are concerned, because their system clocks (or ours) might have drifted seconds or minutes apart from each other. On the other hand, there's probably a way evil Nodes could use a sequence of timestamps from a single source to deduce information they shouldn't know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status

      📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions