Attempt to stabilize channel reconnecting

This commit is contained in:
Raven Scott
2025-12-20 19:09:23 -05:00
parent 575d1c359d
commit 3deb968553
2 changed files with 34 additions and 2 deletions
+6 -1
View File
@@ -1306,9 +1306,14 @@ function performHealthCheck() {
const peerChannel = channelInfo.peerChannels?.get(peerId);
if (!peerChannel) {
// Peer is connected but missing this channel - create it
logDebug('ChannelManager', `Peer ${peerId.substring(0, 16)}... connected but missing channel ${pluginDomain}-${protocol}, creating it`);
const isReconnection = state.peerHistory?.get(peerId)?.some(event => event.type === 'connect') || false;
const reconnectionNote = isReconnection ? ' (reconnection)' : '';
logDebug('ChannelManager', `Peer ${peerId.substring(0, 16)}... connected but missing channel ${pluginDomain}-${protocol}${reconnectionNote}, creating it`);
try {
createPluginChannelsForPeer(peerId, peerChannelInfo.conn, peerChannelInfo.mux);
if (isReconnection) {
logInfo('ChannelManager', `Successfully recreated missing channel ${pluginDomain}-${protocol} for reconnected peer ${peerId.substring(0, 16)}...`);
}
} catch (err) {
logError('ChannelManager', `Error creating missing channel for peer ${peerId.substring(0, 16)}...: ${err.message}`);
}