mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-04 09:16:47 +00:00
refactor(overlay): Overhaul peer disconnection logic
This commit refactors the peer shutdown and failure handling mechanism to be more robust, consistent, and communicative. The previous implementation used raw strings to represent error reasons and did not communicate these reasons to peers when shutting down a connection. With this change disconnections are now explicitly communicated via a `TMClose` protocol message with strongly-typed reasons. This new approach provides better diagnostics and makes the peer disconnection process more stable and predictable.
This commit is contained in:
@@ -26,6 +26,7 @@ enum MessageType {
|
||||
mtREPLAY_DELTA_RESPONSE = 60;
|
||||
mtHAVE_TRANSACTIONS = 63;
|
||||
mtTRANSACTIONS = 64;
|
||||
mtCLOSE = 65;
|
||||
}
|
||||
|
||||
// token, iterations, target, challenge = issue demand for proof of work
|
||||
@@ -341,3 +342,19 @@ message TMReplayDeltaResponse {
|
||||
message TMHaveTransactions {
|
||||
repeated bytes hashes = 1;
|
||||
}
|
||||
|
||||
enum TMCloseReason {
|
||||
crRESOURCE = 1;
|
||||
crINVALID_CLOSED_LEDGER = 2;
|
||||
crINVALID_PREV_LEDGER = 3;
|
||||
crBAD_LEDGER_HEADERS = 4;
|
||||
crLARGE_SEND_QUEUE = 5;
|
||||
crNOT_USEFUL = 6;
|
||||
crPING_TIMEOUT = 7;
|
||||
crINTERNAL = 8;
|
||||
crSHUTDOWN = 9;
|
||||
}
|
||||
|
||||
message TMClose {
|
||||
required TMCloseReason reason = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user