Skip to content

Commit

Permalink
expose SockAddr in the callback
Browse files Browse the repository at this point in the history
Consensus needs a way of identifying peers; This patch exposes the
SockAddr of the remote peer to the callback.
  • Loading branch information
coot committed Jul 10, 2019
1 parent cbc242d commit 45b07d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions ouroboros-network/src/Ouroboros/Network/Subscription/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ subscribeTo
-> Maybe Socket.SockAddr
-> (Socket.SockAddr -> Maybe DiffTime)
-> TVar IO Int
-> (Socket.Socket -> IO ())
-> (Socket.Socket -> Socket.SockAddr -> IO ())
-> SubscriptionTarget IO Socket.SockAddr
-> IO ()
subscribeTo tbl threadPool tracer localIPv4_m localIPv6_m connectionAttemptDelay
Expand Down Expand Up @@ -205,14 +205,14 @@ subscribeTo tbl threadPool tracer localIPv4_m localIPv6_m connectionAttemptDelay
else return ConnectFail
traceWith tracer $ SubscriptionTraceConnectEnd remoteAddr result
case result of
ConnectSuccess -> k sd
ConnectSuccess -> k sd remoteAddr
ConnectSuccessLast -> do
outstandingConThreads <- atomically $ readTVar conThreads
mapM_ (\a -> throwTo a
(SubscriberError SubscriberParrallelConnectionCancelled
"Parrallel connection cancelled"
callStack)) outstandingConThreads
k sd
k sd remoteAddr
ConnectFail -> return ()

)
Expand All @@ -229,7 +229,7 @@ ipSubscriptionWorker
-> Maybe Socket.SockAddr
-> (Socket.SockAddr -> Maybe DiffTime)
-> IPSubscriptionTarget
-> (Socket.Socket -> IO ())
-> (Socket.Socket -> Socket.SockAddr -> IO ())
-> (Async () -> IO t)
-> IO t
ipSubscriptionWorker tbl tracer localIPv4 localIPv6 connectionAttemptDelay ips cb k =
Expand All @@ -251,7 +251,7 @@ subscriptionWorker
-> (Socket.SockAddr -> Maybe DiffTime)
-> IO (SubscriptionTarget IO Socket.SockAddr)
-> Int
-> (Socket.Socket -> IO ())
-> (Socket.Socket -> Socket.SockAddr -> IO ())
-> (Async () -> IO t)
-> IO t
subscriptionWorker tbl tracer localIPv4 localIPv6 connectionAttemptDelay getTargets valency
Expand Down
4 changes: 2 additions & 2 deletions ouroboros-network/src/Ouroboros/Network/Subscription/Dns.hs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ dnsSubscriptionWorker'
-> Maybe Socket.SockAddr
-> (Socket.SockAddr -> Maybe DiffTime)
-> DnsSubscriptionTarget
-> (Socket.Socket -> IO ())
-> (Socket.Socket -> Socket.SockAddr -> IO ())
-> (Async IO () -> IO t)
-> IO t
dnsSubscriptionWorker' tbl subTracer dnsTracer resolver localIPv4 localIPv6
Expand All @@ -208,7 +208,7 @@ dnsSubscriptionWorker
-> Maybe Socket.SockAddr
-> (Socket.SockAddr -> Maybe DiffTime)
-> DnsSubscriptionTarget
-> (Socket.Socket -> IO ())
-> (Socket.Socket -> Socket.SockAddr -> IO ())
-> (Async IO () -> IO t)
-> IO t
dnsSubscriptionWorker tbl subTracer dnsTracer localIPv4 localIPv6 connectionAttemptDelay dst cb
Expand Down

0 comments on commit 45b07d3

Please sign in to comment.