Skip to content

Commit bab45e9

Browse files
committed
fix: all tests now passing
1 parent d90e6f2 commit bab45e9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/nodes/NodeConnectionManager.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,14 +1771,18 @@ class NodeConnectionManager {
17711771
);
17721772
}
17731773
});
1774+
// Gracefully close the connection if there was no error
1775+
await writer?.close();
1776+
await reader?.cancel();
17741777
connectionsEntry.authenticatedForward = AuthenticatingState.SUCCESS;
17751778
} catch (e) {
1776-
await reader?.cancel(e);
1777-
await writer?.abort(e);
17781779
const err = new nodesErrors.ErrorNodeManagerAuthenticationFailed(
17791780
undefined,
17801781
{ cause: e },
17811782
);
1783+
await writer?.abort(err);
1784+
await reader?.cancel(err);
1785+
// Make sure any pending authentication is set to FAIL accordingly
17821786
if (
17831787
connectionsEntry.authenticatedForward === AuthenticatingState.PENDING
17841788
) {
@@ -1790,11 +1794,7 @@ class NodeConnectionManager {
17901794
connectionsEntry.authenticatedReverse = AuthenticatingState.FAIL;
17911795
}
17921796
this.authenticateFail(targetNodeIdString, err);
1793-
throw err;
17941797
}
1795-
// Gracefully close the connection if there was no error
1796-
await reader?.cancel();
1797-
await writer?.close();
17981798
// Check the reverse result
17991799
switch (connectionsEntry.authenticatedReverse) {
18001800
case AuthenticatingState.SUCCESS:

tests/nodes/NodeManager.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe(`${NodeManager.name}`, () => {
7676
const timeoutTime = 1000;
7777
const dummyAgentService = {
7878
nodesAuthenticateConnection: new DummyNodesAuthenticateConnection({}),
79-
} as AgentServerManifest;
79+
} as unknown as AgentServerManifest;
8080

8181
let dataDir: string;
8282

0 commit comments

Comments
 (0)