Skip to content

Commit 1cc8ad1

Browse files
committed
chore: updated js-rpc from 1.0.0 to 1.0.1
1 parent 958bf21 commit 1cc8ad1

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"@matrixai/mdns": "^2.0.7",
9494
"@matrixai/quic": "^2.0.9",
9595
"@matrixai/resources": "^2.0.1",
96-
"@matrixai/rpc": "^1.0.0",
96+
"@matrixai/rpc": "^1.0.1",
9797
"@matrixai/timer": "^2.1.1",
9898
"@matrixai/workers": "^2.0.0",
9999
"@matrixai/ws": "^2.0.5",

src/nodes/NodeConnectionManager.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,24 +1697,16 @@ class NodeConnectionManager {
16971697
throw new nodesErrors.ErrorNodeConnectionManagerConnectionNotFound();
16981698
}
16991699
// Need to make an authenticate request here. Get the connection and RPC.
1700-
let reader:
1701-
| ReadableStreamDefaultReader<
1702-
SuccessMessage | NodesAuthenticateConnectionMessage
1703-
>
1704-
| undefined;
1705-
let writer:
1706-
| WritableStreamDefaultWriter<
1707-
SuccessMessage | NodesAuthenticateConnectionMessage
1708-
>
1709-
| undefined;
1700+
let rpcCancel: ((reason?: any) => void) | undefined;
17101701
try {
17111702
const authenticateMessage =
17121703
await this.authenticateNetworkForwardCallback(ctx);
17131704
await withF([this.acquireConnectionInternal(nodeId)], async ([conn]) => {
17141705
const authStream =
17151706
await conn.rpcClient.methods.nodesAuthenticateConnection(ctx);
1716-
writer = authStream.writable.getWriter();
1717-
reader = authStream.readable.getReader();
1707+
const writer = authStream.writable.getWriter();
1708+
const reader = authStream.readable.getReader();
1709+
rpcCancel = (reason?: any) => authStream.cancel(reason);
17181710

17191711
// Write the forward authentication message from this node
17201712
await writer.write(authenticateMessage);
@@ -1770,18 +1762,15 @@ class NodeConnectionManager {
17701762
'Expected success message but got authentication message',
17711763
);
17721764
}
1773-
await writer.close();
1774-
await reader.cancel();
1765+
rpcCancel();
17751766
});
17761767
connectionsEntry.authenticatedForward = AuthenticatingState.SUCCESS;
17771768
} catch (e) {
17781769
const err = new nodesErrors.ErrorNodeManagerAuthenticationFailed(
17791770
undefined,
17801771
{ cause: e },
17811772
);
1782-
// We only care if the reader and writer closed properly
1783-
await writer?.abort(err).catch(() => {});
1784-
await reader?.cancel(err).catch(() => {});
1773+
rpcCancel?.(err);
17851774
// Make sure any pending authentication is set to FAIL accordingly
17861775
if (
17871776
connectionsEntry.authenticatedForward === AuthenticatingState.PENDING

0 commit comments

Comments
 (0)