Skip to content

Commit

Permalink
Move constant into function were it used.
Browse files Browse the repository at this point in the history
Proper error declaration.
  • Loading branch information
alexeykiselev committed Dec 12, 2024
1 parent ff41cf7 commit e2f697f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/networking/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package networking
import (
"context"
"errors"
"fmt"
"io"
)

const Namespace = "NET"

// TODO: Consider special Error type for all [networking] errors.
var (
// ErrInvalidConfigurationNoProtocol is used when the configuration has no protocol.
ErrInvalidConfigurationNoProtocol = errors.New("invalid configuration: empty protocol")
Expand All @@ -23,7 +23,7 @@ var (
ErrSessionShutdown = errors.New("session shutdown")

// ErrConnectionWriteTimeout indicates that we hit the timeout writing to the underlying stream connection.
ErrConnectionWriteTimeout = fmt.Errorf("connection write timeout")
ErrConnectionWriteTimeout = errors.New("connection write timeout")

// ErrKeepAliveProtocolFailure is used when the protocol failed to provide a keep-alive message.
ErrKeepAliveProtocolFailure = errors.New("protocol failed to provide a keep-alive message")
Expand Down
3 changes: 1 addition & 2 deletions pkg/networking/timers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import (
"time"
)

const initialTimerInterval = time.Hour * 1e6

type timerPool struct {
p *sync.Pool
}

func newTimerPool() *timerPool {
const initialTimerInterval = time.Hour * 1e6
return &timerPool{
p: &sync.Pool{
New: func() any {
Expand Down

0 comments on commit e2f697f

Please sign in to comment.