1- // Package transport provides long-lived http/tcp connections for
2- // intra-cluster communications (see README for details and usage example).
1+ // Package transport provides long-lived http/tcp connections for intra-cluster communications
32/*
43 * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
54 */
@@ -183,14 +182,14 @@ func (s *streamBase) startSend(streamable fmt.Stringer) (err error) {
183182 return
184183}
185184
186- func (s * streamBase ) newErr (detail string ) error {
185+ func (s * streamBase ) newErr (ctx string ) error {
187186 reason , errT := s .TermInfo ()
188187 return & ErrStreamTerm {
189188 err : errT ,
190189 dst : s .dstID ,
191190 loghdr : s .loghdr ,
192191 reason : reason ,
193- detail : detail ,
192+ ctx : ctx ,
194193 }
195194}
196195
@@ -306,16 +305,17 @@ func (s *streamBase) sendLoop(config *cmn.Config, dryrun bool) {
306305 return
307306 }
308307
309- // termination is caused by anything other than Fin()
310- // (reasonStopped is, effectively, abort via Stop() - totally legit)
311- var errExt error
312- if reason != reasonStopped {
313- errExt = fmt .Errorf ("%s[term-reason: %s, err: %w]" , s , reason , err )
314- nlog .Errorln (errExt )
308+ // termination is caused by anything other than Fin() ---------------
309+ // 1) reasonStopped via Stop(), or
310+ // 2) broken pipe, connection reset, etc.
311+ // steps:
312+ // - abort parent xaction if defined AND the parent's TermedCB is nil
313+ // - wait and complete
314+ // - call parent's TermedCB if defined ---------- (notice "either/OR")
315315
316- // NOTE: aborting grandparent xaction
317- if s .parent != nil && s .parent .Xact != nil {
318- s .parent .Xact .Abort (errExt )
316+ if reason != reasonStopped {
317+ if s .parent != nil && s .parent .Xact != nil && s . parent . TermedCB == nil {
318+ s .parent .Xact .Abort (s . newErr ( "" ) )
319319 }
320320 }
321321
@@ -325,10 +325,9 @@ func (s *streamBase) sendLoop(config *cmn.Config, dryrun bool) {
325325 // cleanup
326326 s .streamer .abortPending (err , false /*completions*/ )
327327
328- // notify parent if defined
329328 if reason != reasonStopped {
330329 if s .parent != nil && s .parent .TermedCB != nil {
331- s .parent .TermedCB (s .dstID , errExt )
330+ s .parent .TermedCB (s .dstID , err )
332331 }
333332 }
334333
0 commit comments