@@ -36,7 +36,7 @@ type ConnLogKind int
36
36
37
37
var (
38
38
errUnknownRequest = errors .New ("the passed connected request doesn't belong " +
39
- "to the current connection or connection pool" )
39
+ "to the current connection or connection pool" )
40
40
)
41
41
42
42
const (
@@ -113,7 +113,7 @@ func (d defaultLogger) Report(event ConnLogKind, conn *Connection, v ...interfac
113
113
case LogUnexpectedResultId :
114
114
header := v [0 ].(Header )
115
115
log .Printf ("tarantool: connection %s got unexpected request ID (%d) in response " +
116
- "(probably cancelled request)" ,
116
+ "(probably cancelled request)" ,
117
117
conn .Addr (), header .RequestId )
118
118
case LogWatchEventReadFailed :
119
119
err := v [0 ].(error )
@@ -515,8 +515,8 @@ func (conn *Connection) dial(ctx context.Context) error {
515
515
516
516
// Subscribe shutdown event to process graceful shutdown.
517
517
if conn .shutdownWatcher == nil &&
518
- isFeatureInSlice (iproto .IPROTO_FEATURE_WATCHERS ,
519
- conn .serverProtocolInfo .Features ) {
518
+ isFeatureInSlice (iproto .IPROTO_FEATURE_WATCHERS ,
519
+ conn .serverProtocolInfo .Features ) {
520
520
watcher , werr := conn .newWatcherImpl (shutdownEventKey , shutdownEventCallback )
521
521
if werr != nil {
522
522
return werr
@@ -528,7 +528,7 @@ func (conn *Connection) dial(ctx context.Context) error {
528
528
}
529
529
530
530
func pack (h * smallWBuf , enc * msgpack.Encoder , reqid uint32 ,
531
- req Request , streamId uint64 , res SchemaResolver ) (err error ) {
531
+ req Request , streamId uint64 , res SchemaResolver ) (err error ) {
532
532
const uint32Code = 0xce
533
533
const uint64Code = 0xcf
534
534
const streamBytesLenUint64 = 10
@@ -665,7 +665,7 @@ func (conn *Connection) runReconnects(ctx context.Context) error {
665
665
return err
666
666
}
667
667
if clientErr , ok := err .(ClientError ); ok &&
668
- clientErr .Code == ErrConnectionClosed {
668
+ clientErr .Code == ErrConnectionClosed {
669
669
return err
670
670
}
671
671
} else {
@@ -984,7 +984,10 @@ func (conn *Connection) newFuture(req Request) (fut *Future) {
984
984
if ctx != nil {
985
985
select {
986
986
case <- ctx .Done ():
987
- fut .SetError (fmt .Errorf ("context is done (request ID %d)" , fut .requestId ))
987
+ fut .SetError (fmt .Errorf (
988
+ "context is done (request ID %d): %w" ,
989
+ fut .requestId , context .Cause (ctx ),
990
+ ))
988
991
shard .rmut .Unlock ()
989
992
return
990
993
default :
@@ -1026,7 +1029,10 @@ func (conn *Connection) contextWatchdog(fut *Future, ctx context.Context) {
1026
1029
case <- fut .done :
1027
1030
return
1028
1031
default :
1029
- conn .cancelFuture (fut , fmt .Errorf ("context is done (request ID %d)" , fut .requestId ))
1032
+ conn .cancelFuture (fut , fmt .Errorf (
1033
+ "context is done (request ID %d): %w" ,
1034
+ fut .requestId , context .Cause (ctx ),
1035
+ ))
1030
1036
}
1031
1037
}
1032
1038
@@ -1228,9 +1234,9 @@ func read(r io.Reader, lenbuf []byte) (response []byte, err error) {
1228
1234
return
1229
1235
}
1230
1236
length = (uint64 (lenbuf [1 ]) << 24 ) +
1231
- (uint64 (lenbuf [2 ]) << 16 ) +
1232
- (uint64 (lenbuf [3 ]) << 8 ) +
1233
- uint64 (lenbuf [4 ])
1237
+ (uint64 (lenbuf [2 ]) << 16 ) +
1238
+ (uint64 (lenbuf [3 ]) << 8 ) +
1239
+ uint64 (lenbuf [4 ])
1234
1240
1235
1241
switch {
1236
1242
case length == 0 :
@@ -1279,8 +1285,8 @@ func (conn *Connection) ConfiguredTimeout() time.Duration {
1279
1285
func (conn * Connection ) SetSchema (s Schema ) {
1280
1286
sCopy := s .copy ()
1281
1287
spaceAndIndexNamesSupported :=
1282
- isFeatureInSlice (iproto .IPROTO_FEATURE_SPACE_AND_INDEX_NAMES ,
1283
- conn .serverProtocolInfo .Features )
1288
+ isFeatureInSlice (iproto .IPROTO_FEATURE_SPACE_AND_INDEX_NAMES ,
1289
+ conn .serverProtocolInfo .Features )
1284
1290
1285
1291
conn .mutex .Lock ()
1286
1292
defer conn .mutex .Unlock ()
@@ -1463,7 +1469,7 @@ func (conn *Connection) NewWatcher(key string, callback WatchCallback) (Watcher,
1463
1469
if ! isFeatureInSlice (iproto .IPROTO_FEATURE_WATCHERS ,
1464
1470
conn .serverProtocolInfo .Features ) {
1465
1471
err := fmt .Errorf ("the feature %s must be supported by connection " +
1466
- "to create a watcher" , iproto .IPROTO_FEATURE_WATCHERS )
1472
+ "to create a watcher" , iproto .IPROTO_FEATURE_WATCHERS )
1467
1473
return nil , err
1468
1474
}
1469
1475
0 commit comments