Skip to content

Commit

Permalink
client: use bigger TTL, expose it to clients
Browse files Browse the repository at this point in the history
This value is better be known to users and it's better be more than two since
we can have more complicated communications in future.

Refs. nspcc-dev/neofs-node#2447

Signed-off-by: Roman Khimov <roman@nspcc.ru>
  • Loading branch information
roman-khimov committed Feb 29, 2024
1 parent d1bb088 commit 021cdfa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const (
fieldNumSigPubKey = 1
fieldNumSigVal = 2
fieldNumSigScheme = 3

// DefaultTTL is a TTL used for NeoFS requests if no other value is
// set specifically for a call. It limits the number of hops the
// request can transit (see specification for details).
DefaultTTL = 8
)

// groups meta parameters shared between all Client operations.
Expand Down Expand Up @@ -120,7 +125,7 @@ func (x contextCall) prepareRequest() {
}

if meta.GetTTL() == 0 {
meta.SetTTL(2)
meta.SetTTL(DefaultTTL)
}

if meta.GetVersion() == nil {
Expand All @@ -137,7 +142,7 @@ func (x contextCall) prepareRequest() {
func (c *Client) prepareRequest(req request, meta *v2session.RequestMetaHeader) {
ttl := meta.GetTTL()
if ttl == 0 {
ttl = 2
ttl = DefaultTTL
}

verV2 := meta.GetVersion()
Expand Down

0 comments on commit 021cdfa

Please sign in to comment.