Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "polykey",
"version": "1.21.1",
"version": "1.21.2",
"homepage": "https://polykey.com",
"author": "Matrix AI",
"contributors": [
Expand Down
1 change: 1 addition & 0 deletions src/client/handlers/NodesListConnections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class NodesListConnections extends ServerHandler<
port: connection.address.port,
timeout: connection.timeout ?? -1,
usageCount: connection.usageCount,
authenticated: connection.authenticated,
};
}
};
Expand Down
1 change: 1 addition & 0 deletions src/client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ type NodeConnectionMessage = NodeAddressMessage & {
hostname: string;
usageCount: number;
timeout: number;
authenticated: boolean;
};

// Gestalts messages
Expand Down
7 changes: 7 additions & 0 deletions src/nodes/NodeConnectionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,7 @@ class NodeConnectionManager {
address: { host: Host; port: Port; hostname: Hostname | undefined };
usageCount: number;
timeout: number | undefined;
authenticated: boolean;
}> {
const results: Array<{
nodeId: NodeId;
Expand All @@ -1378,13 +1379,18 @@ class NodeConnectionManager {
address: { host: Host; port: Port; hostname: Hostname | undefined };
usageCount: number;
timeout: number | undefined;
authenticated: boolean;
}> = [];
for (const [nodeIdString, connectionsEntry] of this.connections.entries()) {
const nodeId = IdInternal.fromString<NodeId>(nodeIdString);
const connections = connectionsEntry.connections;
for (const connectionId of Object.keys(connections)) {
const connectionAndTimer = connections[connectionId];
const connection = connectionAndTimer.connection;
const forwardAuthenticated =
connectionsEntry.authenticatedForward === AuthenticatingState.SUCCESS;
const reverseAuthenticated =
connectionsEntry.authenticatedReverse === AuthenticatingState.SUCCESS;
results.push({
nodeId,
connectionId: connection.connectionId,
Expand All @@ -1397,6 +1403,7 @@ class NodeConnectionManager {
},
usageCount: connectionAndTimer.usageCount,
timeout: connectionAndTimer.timer?.getTimeout(),
authenticated: forwardAuthenticated && reverseAuthenticated,
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/NodeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class NodeManager {
this.logger.debug('Checking connections');
let connectionCount = 0;
for (const connection of this.nodeConnectionManager.listConnections()) {
if (connection.primary) {
if (connection.primary && connection.authenticated) {
const [bucketId] = this.nodeGraph.bucketIndex(connection.nodeId);
if (bucketId === 255) connectionCount++;
}
Expand Down