mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-29 00:25:48 +00:00
Add a heartbeat to detect hung connections (#1101)
* disconnect is now reconnect on heartbeat fail
This commit is contained in:
@@ -336,6 +336,19 @@ export function createMockRippled(port) {
|
||||
}
|
||||
});
|
||||
|
||||
mock.on('request_ping', function (request, conn) {
|
||||
// NOTE: We give the response a timeout of 2 second, so that tests can
|
||||
// set their timeout threshold to greater than or less than this number
|
||||
// to test timeouts.
|
||||
setTimeout(() => {
|
||||
conn.send(createResponse(request, {
|
||||
"result": {},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}));
|
||||
}, 1000 * 2);
|
||||
});
|
||||
|
||||
mock.on('request_tx', function (request, conn) {
|
||||
assert.strictEqual(request.command, 'tx');
|
||||
if (request.transaction === hashes.VALID_TRANSACTION_HASH) {
|
||||
|
||||
Reference in New Issue
Block a user