Skip to content

Commit

Permalink
Add SetWriteDeadline to Underlay
Browse files Browse the repository at this point in the history
  • Loading branch information
plorenz committed Mar 3, 2023
1 parent a28dff8 commit 22655f6
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ type Underlay interface {
IsClosed() bool
Headers() map[int32][]byte
SetWriteTimeout(duration time.Duration) error
SetWriteDeadline(time time.Time) error
GetLocalAddr() net.Addr
GetRemoteAddr() net.Addr
}
Expand Down
4 changes: 4 additions & 0 deletions classic_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func (impl *classicImpl) SetWriteTimeout(duration time.Duration) error {
return impl.peer.SetWriteDeadline(time.Now().Add(duration))
}

func (impl *classicImpl) SetWriteDeadline(deadline time.Time) error {
return impl.peer.SetWriteDeadline(deadline)
}

func (impl *classicImpl) rxHello() (*Message, error) {
msg, readF, marshallF, err := readHello(impl.peer)
impl.readF = readF
Expand Down
4 changes: 4 additions & 0 deletions datagram/underlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,7 @@ func (self *Underlay) Headers() map[int32][]byte {
func (self *Underlay) SetWriteTimeout(duration time.Duration) error {
return self.peer.SetWriteDeadline(time.Now().Add(duration))
}

func (self *Underlay) SetWriteDeadline(deadline time.Time) error {
return self.peer.SetWriteDeadline(deadline)
}
4 changes: 4 additions & 0 deletions existing_conn_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ func (impl *existingConnImpl) SetWriteTimeout(duration time.Duration) error {
return impl.peer.SetWriteDeadline(time.Now().Add(duration))
}

func (impl *existingConnImpl) SetWriteDeadline(deadline time.Time) error {
return impl.peer.SetWriteDeadline(deadline)
}

func (impl *existingConnImpl) rxHello() (*Message, error) {
msg, readF, marshallF, err := readHello(impl.peer)
impl.readF = readF
Expand Down
4 changes: 4 additions & 0 deletions memory/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ func (impl *memoryImpl) SetWriteTimeout(time.Duration) error {
panic("SetWriteTimeout not implemented")
}

func (self *memoryImpl) SetWriteDeadline(deadline time.Time) error {
panic("SetWriteDeadline not implemented")
}

func (impl *memoryImpl) Rx() (*channel.Message, error) {
if impl.closed {
return nil, errors.New("underlay closed")
Expand Down
4 changes: 4 additions & 0 deletions reconnecting_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ func (impl *reconnectingImpl) SetWriteTimeout(duration time.Duration) error {
return impl.peer.SetWriteDeadline(time.Now().Add(duration))
}

func (impl *reconnectingImpl) SetWriteDeadline(deadline time.Time) error {
return impl.peer.SetWriteDeadline(deadline)
}

type reconnectingImpl struct {
peer transport.Conn
id *identity.TokenId
Expand Down
4 changes: 4 additions & 0 deletions websockets/ws_underlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,7 @@ func (self *Underlay) Headers() map[int32][]byte {
func (self *Underlay) SetWriteTimeout(duration time.Duration) error {
return self.peer.SetWriteDeadline(time.Now().Add(duration))
}

func (self *Underlay) SetWriteDeadline(deadline time.Time) error {
return self.peer.SetWriteDeadline(deadline)
}
4 changes: 4 additions & 0 deletions ws_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func (impl *wsImpl) SetWriteTimeout(duration time.Duration) error {
return impl.peer.SetWriteDeadline(time.Now().Add(duration))
}

func (self *wsImpl) SetWriteDeadline(deadline time.Time) error {
return self.peer.SetWriteDeadline(deadline)
}

func (impl *wsImpl) Rx() (*Message, error) {
if impl.closed {
return nil, errors.New("underlay closed")
Expand Down

0 comments on commit 22655f6

Please sign in to comment.