Skip to content

Commit

Permalink
Merge pull request #4652 from input-output-hk/coot/light-peer-sharing
Browse files Browse the repository at this point in the history
Configurable light peer sharing
  • Loading branch information
coot authored Aug 22, 2023
2 parents f00bf17 + 5d93802 commit f424277
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cardano-client/cardano-client.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ library
containers,
ouroboros-network-api ^>= 0.5.1,
ouroboros-network ^>= 0.9,
ouroboros-network-framework ^>= 0.8,
ouroboros-network-framework >= 0.8 && < 0.10,
network-mux ^>= 0.4,

ghc-options: -Wall
Expand Down
9 changes: 9 additions & 0 deletions ouroboros-network-framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@

### Non-breaking changes

## 0.9.0.0 -- 2023-08-21

### Breaking changes

* Pass `Maybe InformationChannel` to connection manger. This gives us a way to
disable light peer sharing.

### Non-breaking changes

## 0.8.0.0 -- 2023-08-09

### Breaking changes
Expand Down
2 changes: 1 addition & 1 deletion ouroboros-network-framework/demo/connection-manager.hs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ withBidirectionalConnectionManager snocket makeBearer socket
<> debugIOErrorRethrowPolicy))
(\_ -> HandshakeFailure)
(InResponderMode inbgovInfoChannel)
(InResponderMode outgovInfoChannel)
(InResponderMode $ Just outgovInfoChannel)
$ \connectionManager -> do
serverAddr <- Snocket.getLocalAddr snocket socket
withAsync
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: ouroboros-network-framework
version: 0.8.0.0
version: 0.9.0.0
synopsis: Ouroboros network framework
description: Ouroboros network framework.
license: Apache-2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ withConnectionManager
-> InResponderMode muxMode (InformationChannel (NewConnectionInfo peerAddr handle) m)
-- ^ On outbound duplex connections we need to notify the server about
-- a new connection.
-> InResponderMode muxMode (InformationChannel (peerAddr, PeerSharing) m)
-> InResponderMode muxMode (Maybe (InformationChannel (peerAddr, PeerSharing) m))
-- ^ On inbound duplex connections we need to notify the outbound governor about
-- a new connection.
-> (ConnectionManager muxMode socket peerAddr handle handleError m -> m a)
Expand Down Expand Up @@ -1203,7 +1203,8 @@ withConnectionManager ConnectionManagerArguments {
-- this case we don't need to notify the outbound
-- governor.
case outboundGovernorInfoChannel of
InResponderMode infoChannel | notifyOutboundGov ->
InResponderMode (Just infoChannel) | notifyOutboundGov
->
atomically $ InfoChannel.writeMessage
infoChannel
(peerAddr, cmGetPeerSharing versionData)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ prop_valid_transitions (SkewedBool bindToLocalAddress) scheduleMap =
connectionHandler
(\_ -> HandshakeFailure)
(InResponderMode inbgovInfoChannel)
(InResponderMode outgovInfoChannel)
(InResponderMode $ Just outgovInfoChannel)
$ \(connectionManager
:: ConnectionManager InitiatorResponderMode (FD (IOSim s))
Addr (Handle m) Void (IOSim s)) -> do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ withBidirectionalConnectionManager name timeouts
<> assertRethrowPolicy))
(\_ -> HandshakeFailure)
(InResponderMode inbgovInfoChannel)
(InResponderMode outgovInfoChannel)
(InResponderMode $ Just outgovInfoChannel)
$ \connectionManager ->
do
serverAddr <- Snocket.getLocalAddr snocket socket
Expand Down
3 changes: 3 additions & 0 deletions ouroboros-network/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

### Non-breaking changes

* Disable light peer sharing if peer sharing is not enabled.
* Do not use light peer sharing in `node-to-client` case (which leads to a memory leak).

## 0.9.0.0 -- 2023-08-09

### Breaking changes
Expand Down
4 changes: 2 additions & 2 deletions ouroboros-network/ouroboros-network.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: ouroboros-network
version: 0.9.0.0
version: 0.9.1.0
synopsis: A networking layer for the Ouroboros blockchain protocol
description: A networking layer for the Ouroboros blockchain protocol.
license: Apache-2.0
Expand Down Expand Up @@ -126,7 +126,7 @@ library
network-mux,
si-timers,
ouroboros-network-api ^>=0.5.1,
ouroboros-network-framework ^>=0.8,
ouroboros-network-framework ^>=0.9,
ouroboros-network-protocols ^>=0.5.2.0,
strict-stm,
typed-protocols >=0.1.0.4 && <1.0,
Expand Down
7 changes: 4 additions & 3 deletions ouroboros-network/src/Ouroboros/Network/Diffusion/P2P.hs
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,6 @@ runM Interfaces
Just $ withLocalSocket tracer diNtcGetFileDescriptor diNtcSnocket localAddr
$ \localSocket -> do
localInbInfoChannel <- newInformationChannel
localOutInfoChannel <- newInformationChannel
localServerStateVar <- Server.newObservableStateVar ntcInbgovRng

let localConnectionLimits = AcceptedConnectionsLimit maxBound maxBound 0
Expand Down Expand Up @@ -803,7 +802,7 @@ runM Interfaces
localConnectionHandler
classifyHandleError
(InResponderMode localInbInfoChannel)
(InResponderMode localOutInfoChannel)
(InResponderMode Nothing)
$ \(localConnectionManager :: NodeToClientConnectionManager
ntcFd ntcAddr ntcVersion
ntcVersionData m)
Expand Down Expand Up @@ -1083,7 +1082,9 @@ runM Interfaces
connectionHandler
classifyHandleError
(InResponderMode inboundInfoChannel)
(InResponderMode outboundInfoChannel)
(if daOwnPeerSharing /= NoPeerSharing
then InResponderMode (Just outboundInfoChannel)
else InResponderMode Nothing)
$ \(connectionManager
:: NodeToNodeConnectionManager
InitiatorResponderMode ntnFd ntnAddr ntnVersionData ntnVersion m a ()
Expand Down

0 comments on commit f424277

Please sign in to comment.