fix: `dial_feeler(..)` function dial identify protocol
What problem does this PR solve?
The dial_feeler(..) function dial with the identify protocol acctually.
Check List
Tests
- Unit test
- Integration test
- Manual test (add detailed scripts or steps below)
- No code ci-runs-only: [ quick_checks,linters ]
Release note
None: Exclude this PR from the release note.
all sessions open with identify,then it will open others ...
As your said, is it just a bad function name with bad comments?
- I just confused why a function named
dial_feeler(..)but dial with the identify protocol acctually.
https://github.com/nervosnetwork/ckb/blob/b8f655a204de730ec7fbf7c4bd14586ca9edf5dc/network/src/network.rs#L488-L501
[!NOTE] "... Dial just feeler protocol ..."
- If dial with the feeler is inside the identify protocol, why don't just call
dial_identify(..), with error handling.
https://github.com/nervosnetwork/ckb/blob/b8f655a204de730ec7fbf7c4bd14586ca9edf5dc/network/src/network.rs#L477-L486
-
dial_identify(..)will also dial with feeler protocol, too.
If dial with the feeler is inside the identify protocol, why don't just call dial_identify(..), with error handling.
dial feeler success should mark this dial is feeler, but dial identify not
self.with_peer_registry_mut(|reg| {
reg.add_feeler(&addr);
});
These two dial behaviors are mutually exclusive:
- dial feeler will open identify and feeler, then close this session
- dial identify will open identify and all protocols except feeler, and keep connected
- dial identify will open identify and all protocols except feeler, and keep connected
If I was correct, it should be:
dial identify will open identify with all supported protocols inside it, then close feeler, and keep session connected
Am I right? (then I will add this comment into the code)
dial identify will open identify with all supported protocols inside it, then close feeler, and keep the session connected
no, feeler never opened on dial identify https://github.com/nervosnetwork/ckb/blob/b8f655a204de730ec7fbf7c4bd14586ca9edf5dc/network/src/protocols/identify/mod.rs#L483-L486
no, feeler never opened on dial identify
dial_identify:
- A dial identify to B: connected.
dial_feeler:
- A dial identify to B: connected.
- A mark feeler.
- A dial feeler to B. (or B dial feeler to A in callback?)
Am I correct this time?
dial_identify:
- A dial identify to B: connected
- A‘s identify open all protocols except feeler to B
dial_feeler:
- A mark feeler
- A dial identify to B: connected
- A‘s identify open feeler to B
dial_feeler:
- A mark feeler
- A dial identify to B: connected
- A‘s identify open feeler to B
https://github.com/nervosnetwork/ckb/blob/b8f655a204de730ec7fbf7c4bd14586ca9edf5dc/network/src/network.rs#L488-L501
But, in above code, dial_inner is before add_feeler.
So, in my understood, dial-identify.is_ok() --> mark-feeler --> dial-feeler.
But dial_inner is before add_feeler.
I think a better description here is, "After successfully sending the command, mark the feeler", there is no dial completed at this time
there is no dial completed at this time
So, can I say:
In theory, the order is not strong (or strict) promised. Just based on experience in most cases (maybe 99.9999999%).
For example, the return of dial_inner is hanging for a while.