File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
packages/ocap-kernel/src/remotes Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -391,6 +391,16 @@ export async function initNetwork(
391391 continue ;
392392 }
393393
394+ // Check if peer was intentionally closed during dial
395+ if ( intentionallyClosed . has ( peerId ) ) {
396+ logger . log (
397+ `${ peerId } :: peer intentionally closed during dial, closing channel` ,
398+ ) ;
399+ await connectionFactory . closeChannel ( channel , peerId ) ;
400+ reconnectionManager . stopReconnection ( peerId ) ;
401+ return ;
402+ }
403+
394404 // Register the new channel and start reading
395405 registerChannel ( peerId , channel ) ;
396406 }
@@ -762,6 +772,15 @@ export async function initNetwork(
762772 return ;
763773 }
764774
775+ // Check if peer was intentionally closed during dial
776+ if ( intentionallyClosed . has ( targetPeerId ) ) {
777+ logger . log (
778+ `${ targetPeerId } :: peer intentionally closed during dial, closing channel` ,
779+ ) ;
780+ await connectionFactory . closeChannel ( channel , targetPeerId ) ;
781+ throw new Error ( 'Message delivery failed after intentional close' ) ;
782+ }
783+
765784 // Register the new channel and start reading
766785 registerChannel ( targetPeerId , channel ) ;
767786 }
You can’t perform that action at this time.
0 commit comments