Skip to content

Commit ec5d32f

Browse files
committed
fix: switched new info level logs to debug
1 parent dcb85cc commit ec5d32f

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

src/network/ConnectionForward.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class ConnectionForward extends Connection {
125125
// Promise for abortion and timeout
126126
const { p: abortedP, resolveP: resolveAbortedP } = promise<void>();
127127
if (ctx.signal.aborted) {
128-
this.logger.info(`Failed to start Connection Forward: aborted`);
128+
this.logger.debug(`Failed to start Connection Forward: aborted`);
129129
// This is for arbitrary abortion reason provided by the caller
130130
// Re-throw the default timeout error as a network timeout error
131131
if (
@@ -186,7 +186,7 @@ class ConnectionForward extends Connection {
186186
this.tlsSocket.destroy();
187187
}
188188
this.utpSocket.off('message', this.handleMessage);
189-
this.logger.info(`Failed to start Connection Forward: ${e.message}`);
189+
this.logger.debug(`Failed to start Connection Forward: ${e.message}`);
190190
throw new networkErrors.ErrorConnectionStart(undefined, {
191191
cause: e,
192192
});
@@ -196,7 +196,7 @@ class ConnectionForward extends Connection {
196196
this.tlsSocket.on('error', this.handleError);
197197
this.tlsSocket.off('error', handleStartError);
198198
if (ctx.signal.aborted) {
199-
this.logger.info(`Failed to start Connection Forward: aborted`);
199+
this.logger.debug(`Failed to start Connection Forward: aborted`);
200200
// Clean up partial start
201201
// TLSSocket isn't established yet, so it is destroyed
202202
if (!this.tlsSocket.destroyed) {
@@ -220,7 +220,7 @@ class ConnectionForward extends Connection {
220220
serverCertChain,
221221
);
222222
} catch (e) {
223-
this.logger.info(
223+
this.logger.debug(
224224
`Failed to start Connection Forward: verification failed`,
225225
);
226226
// Clean up partial start

src/nodes/NodeConnection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class NodeConnection<T extends GRPCClient> {
121121
// Think about this
122122
logger: clientLogger,
123123
destroyCallback: async () => {
124-
clientLogger.info(`GRPC client triggered destroyedCallback`);
124+
clientLogger.debug(`GRPC client triggered destroyedCallback`);
125125
if (
126126
nodeConnection[asyncInit.status] !== 'destroying' &&
127127
!nodeConnection[asyncInit.destroyed]
@@ -189,7 +189,7 @@ class NodeConnection<T extends GRPCClient> {
189189
) {
190190
await this.client.destroy({ timeout });
191191
}
192-
this.logger.info(`${this.constructor.name} triggered destroyedCallback`);
192+
this.logger.debug(`${this.constructor.name} triggered destroyedCallback`);
193193
await this.destroyCallback();
194194
this.logger.info(`Destroyed ${this.constructor.name}`);
195195
}

src/nodes/NodeConnectionManager.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -295,24 +295,24 @@ class NodeConnectionManager {
295295
): Promise<ConnectionAndTimer> {
296296
const targetNodeIdString = targetNodeId.toString() as NodeIdString;
297297
const targetNodeIdEncoded = nodesUtils.encodeNodeId(targetNodeId);
298-
this.logger.info(`Getting NodeConnection for ${targetNodeIdEncoded}`);
298+
this.logger.debug(`Getting NodeConnection for ${targetNodeIdEncoded}`);
299299
return await this.connectionLocks.withF(
300300
[targetNodeIdString, Lock],
301301
async () => {
302302
const connAndTimer = this.connections.get(targetNodeIdString);
303303
if (connAndTimer != null) {
304-
this.logger.info(
304+
this.logger.debug(
305305
`Found existing NodeConnection for ${targetNodeIdEncoded}`,
306306
);
307307
return connAndTimer;
308308
}
309309
// Creating the connection and set in map
310-
this.logger.info(`Finding address for ${targetNodeIdEncoded}`);
310+
this.logger.debug(`Finding address for ${targetNodeIdEncoded}`);
311311
const targetAddress = await this.findNode(targetNodeId);
312312
if (targetAddress == null) {
313313
throw new nodesErrors.ErrorNodeGraphNodeIdNotFound();
314314
}
315-
this.logger.info(
315+
this.logger.debug(
316316
`Found address for ${targetNodeIdEncoded} at ${targetAddress.host}:${targetAddress.port}`,
317317
);
318318
// If the stored host is not a valid host (IP address),
@@ -323,7 +323,7 @@ class NodeConnectionManager {
323323
const targetAddresses = await networkUtils.resolveHostnames([
324324
targetAddress,
325325
]);
326-
this.logger.info(`Creating NodeConnection for ${targetNodeIdEncoded}`);
326+
this.logger.debug(`Creating NodeConnection for ${targetNodeIdEncoded}`);
327327
// Start the hole punching only if we are not connecting to seed nodes
328328
const seedNodes = this.getSeedNodes();
329329
if (this.isSeedNode(targetNodeId)) {
@@ -376,7 +376,7 @@ class NodeConnectionManager {
376376
void nodeConnectionProm.then(
377377
() => firstConnectionIndexProm.resolveP(index),
378378
(e) => {
379-
this.logger.info(
379+
this.logger.debug(
380380
`Creating NodeConnection failed for ${targetNodeIdEncoded}`,
381381
);
382382
// Disable destroyCallback clean up
@@ -394,7 +394,7 @@ class NodeConnectionManager {
394394
newConnection = await Promise.any(nodeConnectionProms);
395395
} catch (e) {
396396
// All connections failed to establish
397-
this.logger.info(
397+
this.logger.debug(
398398
`Failed NodeConnection for ${targetNodeIdEncoded} with ${errors}`,
399399
);
400400
if (errors.length === 1) {
@@ -423,7 +423,7 @@ class NodeConnectionManager {
423423
);
424424
// Final set up
425425
void destroyCallbackProms[successfulIndex].p.then(async () => {
426-
this.logger.info('DestroyedCallback was called');
426+
this.logger.debug('DestroyedCallback was called');
427427
// To avoid deadlock only in the case where this is called
428428
// we want to check for destroying connection and read lock
429429
const connAndTimer = this.connections.get(targetNodeIdString);
@@ -454,7 +454,7 @@ class NodeConnectionManager {
454454
};
455455
this.connections.set(targetNodeIdString, newConnAndTimer);
456456
// Enable destroyCallback clean up
457-
this.logger.info(`Created NodeConnection for ${targetNodeIdEncoded}`);
457+
this.logger.debug(`Created NodeConnection for ${targetNodeIdEncoded}`);
458458
return newConnAndTimer;
459459
},
460460
);
@@ -471,7 +471,7 @@ class NodeConnectionManager {
471471
async () => {
472472
const connAndTimer = this.connections.get(targetNodeIdString);
473473
if (connAndTimer?.connection == null) return;
474-
this.logger.info(
474+
this.logger.debug(
475475
`Destroying NodeConnection for ${nodesUtils.encodeNodeId(
476476
targetNodeId,
477477
)}`,

src/nodes/NodeManager.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ class NodeManager {
123123
ctx,
124124
taskInfo,
125125
) => {
126-
this.logger.info('Checking seed connections');
126+
this.logger.debug('Checking seed connections');
127127
// Check for existing seed node connections
128128
const seedNodes = this.nodeConnectionManager.getSeedNodes();
129129
const allInactive = !seedNodes
130130
.map((nodeId) => this.nodeConnectionManager.hasConnection(nodeId))
131131
.reduce((a, b) => a || b);
132132
try {
133133
if (allInactive) {
134-
this.logger.info(
134+
this.logger.debug(
135135
'No active seed connections were found, retrying network entry',
136136
);
137137
// If no seed node connections exist then we redo syncNodeGraph
@@ -142,7 +142,7 @@ class NodeManager {
142142
seedNodes.map((nodeId) => {
143143
// Retry any failed seed node connections
144144
if (!this.nodeConnectionManager.hasConnection(nodeId)) {
145-
this.logger.info(
145+
this.logger.debug(
146146
`Re-establishing seed connection for ${nodesUtils.encodeNodeId(
147147
nodeId,
148148
)}`,
@@ -159,7 +159,7 @@ class NodeManager {
159159
);
160160
}
161161
} finally {
162-
this.logger.info('Checked seed connections');
162+
this.logger.debug('Checked seed connections');
163163
// Re-schedule this task
164164
await this.taskManager.scheduleTask({
165165
delay: taskInfo.delay,
@@ -1126,12 +1126,12 @@ class NodeManager {
11261126
const filteredAddresses = addresses.filter(
11271127
(address) => address != null,
11281128
) as Array<NodeAddress>;
1129-
logger.info(
1129+
logger.debug(
11301130
`establishing multi-connection to the following seed nodes ${seedNodes.map(
11311131
(nodeId) => nodesUtils.encodeNodeId(nodeId),
11321132
)}`,
11331133
);
1134-
logger.info(
1134+
logger.debug(
11351135
`and addresses ${filteredAddresses.map(
11361136
(address) => `${address.host}:${address.port}`,
11371137
)}`,
@@ -1145,9 +1145,9 @@ class NodeManager {
11451145
undefined,
11461146
{ signal: ctx.signal },
11471147
);
1148-
logger.info(`Multi-connection established for`);
1148+
logger.debug(`Multi-connection established for`);
11491149
connections.forEach((address, key) => {
1150-
logger.info(
1150+
logger.debug(
11511151
`${nodesUtils.encodeNodeId(key)}@${address.host}:${address.port}`,
11521152
);
11531153
});
@@ -1162,7 +1162,7 @@ class NodeManager {
11621162
const closestNodesAll: Map<NodeId, NodeData> = new Map();
11631163
const localNodeId = this.keyManager.getNodeId();
11641164
let closestNode: NodeId | null = null;
1165-
logger.info('Getting closest nodes');
1165+
logger.debug('Getting closest nodes');
11661166
for (const [nodeId] of connections) {
11671167
const closestNodes =
11681168
await this.nodeConnectionManager.getRemoteNodeClosestNodes(
@@ -1187,11 +1187,11 @@ class NodeManager {
11871187
const distB = nodesUtils.nodeDistance(localNodeId, closestNode);
11881188
if (distA < distB) closestNode = closeNode;
11891189
}
1190-
logger.info('Starting pingsAndSet tasks');
1190+
logger.debug('Starting pingsAndSet tasks');
11911191
const pingTasks: Array<Task> = [];
11921192
for (const [nodeId, nodeData] of closestNodesAll) {
11931193
if (!localNodeId.equals(nodeId)) {
1194-
logger.info(
1194+
logger.debug(
11951195
`pingAndSetTask for ${nodesUtils.encodeNodeId(nodeId)}@${
11961196
nodeData.address.host
11971197
}:${nodeData.address.port}`,
@@ -1215,7 +1215,7 @@ class NodeManager {
12151215
}
12161216
if (block) {
12171217
// We want to wait for all the tasks
1218-
logger.info('Awaiting all pingAndSetTasks');
1218+
logger.debug('Awaiting all pingAndSetTasks');
12191219
await Promise.all(
12201220
pingTasks.map((task) => {
12211221
const prom = task.promise();
@@ -1233,7 +1233,7 @@ class NodeManager {
12331233
);
12341234
}
12351235
// Refreshing every bucket above the closest node
1236-
logger.info(`Triggering refreshBucket tasks`);
1236+
logger.debug(`Triggering refreshBucket tasks`);
12371237
let index = this.nodeGraph.nodeIdBits;
12381238
if (closestNode != null) {
12391239
const [bucketIndex] = this.nodeGraph.bucketIndex(closestNode);
@@ -1245,7 +1245,7 @@ class NodeManager {
12451245
refreshBuckets.push(task.promise());
12461246
}
12471247
if (block) {
1248-
logger.info(`Awaiting refreshBucket tasks`);
1248+
logger.debug(`Awaiting refreshBucket tasks`);
12491249
await Promise.all(refreshBuckets);
12501250
}
12511251
}

0 commit comments

Comments
 (0)