@@ -26,7 +26,6 @@ import (
2626 "github.com/NVIDIA/aistore/cmn/cos"
2727 "github.com/NVIDIA/aistore/cmn/debug"
2828 "github.com/NVIDIA/aistore/cmn/nlog"
29- "github.com/NVIDIA/aistore/core"
3029)
3130
3231// stream TCP/HTTP session: inactive <=> active transitions
8887 reason string
8988 mu sync.Mutex
9089 done atomic.Bool
90+ yelp atomic.Bool
9191 }
92- stats Stats // stream stats (send side - compare with rxStats)
93- time struct {
92+ time struct {
9493 idleTeardown time.Duration // idle timeout
9594 inSend atomic.Bool // true upon Send() or Read() - info for Collector to delay cleanup
9695 ticks int // num 1s ticks until idle timeout
@@ -138,6 +137,7 @@ func newBase(client Client, dstURL, dstID string, extra *Extra) (s *streamBase)
138137 buf , _ := g .mm .AllocSize (int64 (extra .SizePDU ))
139138 s .pdu = newSendPDU (buf )
140139 }
140+ // idle time
141141 if extra .IdleTeardown > 0 {
142142 s .time .idleTeardown = extra .IdleTeardown
143143 } else {
@@ -146,35 +146,14 @@ func newBase(client Client, dstURL, dstID string, extra *Extra) (s *streamBase)
146146 debug .Assert (s .time .idleTeardown >= dfltTick , s .time .idleTeardown , " vs " , dfltTick )
147147 s .time .ticks = int (s .time .idleTeardown / dfltTick )
148148
149- s ._loghdr (sid , dstID , extra )
150-
149+ s .loghdr = _loghdr (s .trname , sid , dstID , true , extra .Compressed ())
151150 s .maxhdr , _ = g .mm .AllocSize (_sizeHdr (extra .Config , int64 (extra .MaxHdrSize )))
152151
153- s .sessST .Store (inactive ) // initiate HTTP session upon the first arrival
152+ // fsm: initiate HTTP session upon the first arrival
153+ s .sessST .Store (inactive )
154154 return s
155155}
156156
157- func (s * streamBase ) _loghdr (sid , dstID string , extra * Extra ) {
158- var (
159- sb strings.Builder
160- l = 2 + len (s .trname ) + len (sid ) + 32 + len (dstID )
161- )
162- sb .Grow (l )
163-
164- sb .WriteString ("s-" )
165- sb .WriteString (s .trname )
166- sb .WriteString (sid )
167- sb .WriteByte ('[' )
168- sb .WriteString (core .T .SID ()) // (consider adding back session ID, as in: [node-ID/110])
169-
170- extra .Lid (& sb ) // + compressed
171-
172- sb .WriteString ("]=>" )
173- sb .WriteString (dstID )
174-
175- s .loghdr = sb .String () // looks like: s-<trname><sid>[<sender-id>]=><dest-id>
176- }
177-
178157// (used on the receive side as well)
179158func _sizeHdr (config * cmn.Config , size int64 ) int64 {
180159 if size != 0 {
@@ -193,7 +172,9 @@ func (s *streamBase) startSend(streamable fmt.Stringer) (err error) {
193172 // slow path
194173 reason , errT := s .TermInfo ()
195174 err = cmn .NewErrStreamTerminated (s .String (), errT , reason , "dropping " + streamable .String ())
196- nlog .Errorln (err )
175+ if s .term .yelp .CAS (false , true ) { // only once
176+ nlog .Errorln (err )
177+ }
197178 return
198179 }
199180
@@ -230,15 +211,6 @@ func (s *streamBase) TermInfo() (reason string, err error) {
230211 return
231212}
232213
233- func (s * streamBase ) GetStats () (stats Stats ) {
234- // byte-num transfer stats
235- stats .Num .Store (s .stats .Num .Load ())
236- stats .Offset .Store (s .stats .Offset .Load ())
237- stats .Size .Store (s .stats .Size .Load ())
238- stats .CompressedSize .Store (s .stats .CompressedSize .Load ())
239- return
240- }
241-
242214func (s * streamBase ) isNextReq () (reason string ) {
243215 for {
244216 select {
@@ -267,7 +239,7 @@ func (s *streamBase) isNextReq() (reason string) {
267239func (s * streamBase ) deactivate () (n int , err error ) {
268240 err = io .EOF
269241 if cmn .Rom .V (5 , cos .ModTransport ) {
270- nlog .Infoln (s .String (), "connection teardown: [" , s .numCur , s . stats . Num . Load (), "]" )
242+ nlog .Infoln (s .String (), "connection teardown: [" , s .numCur , "]" )
271243 }
272244 return
273245}
@@ -384,14 +356,6 @@ func (extra *Extra) Compressed() bool {
384356 return extra .Compression != "" && extra .Compression != apc .CompressNever
385357}
386358
387- func (extra * Extra ) Lid (sb * strings.Builder ) {
388- if extra .Compressed () {
389- sb .WriteByte ('[' )
390- sb .WriteString (extra .Config .Transport .LZ4BlockMaxSize .String ())
391- sb .WriteByte (']' )
392- }
393- }
394-
395359//
396360// misc
397361//
@@ -406,6 +370,25 @@ func dryrun() (dryrun bool) {
406370 return
407371}
408372
373+ func _loghdr (trname , from , to string , transmit , compressed bool ) string {
374+ var (
375+ sb strings.Builder
376+ l = len (trname ) + len (from ) + len (to ) + 16
377+ )
378+ sb .Grow (l )
379+
380+ sb .WriteString (trname )
381+ sb .WriteByte ('[' )
382+ if compressed {
383+ sb .WriteString ("(z)" )
384+ }
385+ sb .WriteString (from )
386+ sb .WriteString (cos .Ternary (transmit , "=>" , "<=" ))
387+ sb .WriteString (to )
388+ sb .WriteByte (']' )
389+ return sb .String ()
390+ }
391+
409392//////////
410393// rtry //
411394//////////
0 commit comments