Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed handshake query delay #4603

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ouroboros-network-framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
* Renamed `serverControlChannel` as `serverInboundInfoChannel` of the `ServerArguments` record.
* Moved `OurboundGovernorInfoChannel` to `ouroboros-network`.

### Non-breaking changes

* Fixed query shutdown timeout in the legacy (non-p2p) mode (20s).

## 0.6.0.1 -- 2023-05-15

* Updated to use `ouroboros-network-api-0.5.0.0`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ makeConnectionHandler muxTracer singMuxMode
atomically $ writePromise (Right HandshakeConnectionQuery)
traceWith tracer $ TrHandshakeQuery vMap
-- Wait 20s for client to receive response, who should close the connection.
threadDelay 20
threadDelay handshake_QUERY_SHUTDOWN_DELAY



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Ouroboros.Network.Protocol.Handshake
, HandshakeResult (..)
, RefuseReason (..)
, Accept (..)
, handshake_QUERY_SHUTDOWN_DELAY
) where

import Control.Monad.Class.MonadAsync
Expand Down Expand Up @@ -182,3 +183,9 @@ runHandshakeServer bearer
haTimeLimits
(fromChannel (muxBearerAsChannel bearer handshakeProtocolNum ResponderDir))
(handshakeServerPeer haVersionDataCodec haAcceptVersion haQueryVersion versions))

-- | A 20s delay after query result was send back, before we close the
-- connection. After that delay we close the connection.
--
handshake_QUERY_SHUTDOWN_DELAY :: DiffTime
handshake_QUERY_SHUTDOWN_DELAY = 20
bolt12 marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions ouroboros-network-framework/src/Ouroboros/Network/Socket.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ module Ouroboros.Network.Socket
, sockAddrFamily
) where

import Control.Concurrent (threadDelay)
import Control.Concurrent.Async
import Control.Concurrent.Class.MonadSTM.Strict
import Control.Exception (SomeException (..))
Expand All @@ -82,6 +81,7 @@ import qualified Codec.CBOR.Term as CBOR
import Control.Monad (unless, when)
import Control.Monad.Class.MonadThrow
import Control.Monad.Class.MonadTime.SI
import Control.Monad.Class.MonadTimer.SI
import qualified Control.Monad.STM as STM
import qualified Data.ByteString.Lazy as BL
import Data.Hashable
Expand Down Expand Up @@ -504,7 +504,7 @@ beginConnection makeBearer muxTracer handshakeTracer handshakeCodec handshakeTim
Right (HandshakeQueryResult _vMap) -> do
traceWith muxTracer' Mx.MuxTraceHandshakeServerEnd
-- Wait 20s for client to receive response, who should close the connection.
threadDelay 20
threadDelay handshake_QUERY_SHUTDOWN_DELAY

RejectConnection st' _peerid -> pure $ Server.Reject st'

Expand Down
Loading