diff options
author | joe <joe@jerkface.net> | 2017-07-17 23:16:17 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-07-17 23:16:17 -0400 |
commit | 156caf1027ebf46b6fae97fbfa5664e9c417eea4 (patch) | |
tree | c7bd0397983ccaa988c81d62d0d4eb6c57e33356 /src/Network | |
parent | 00bbd3607de269ffcd30c42875ea02ca48da44ff (diff) |
Give clientAddress more context to facilitate answering differently
depending on whether we are speaking on the IPv6 or IPv4 networks.
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/QueryResponse.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Network/QueryResponse.hs b/src/Network/QueryResponse.hs index 5083a87c..6fa301c7 100644 --- a/src/Network/QueryResponse.hs +++ b/src/Network/QueryResponse.hs | |||
@@ -71,7 +71,7 @@ sendQuery (Client net d err pending whoami _) meth q addr = do | |||
71 | let (tid, tbl') = dispatchRegister (tableMethods d) mvar tbl | 71 | let (tid, tbl') = dispatchRegister (tableMethods d) mvar tbl |
72 | writeTVar pending tbl' | 72 | writeTVar pending tbl' |
73 | return tid | 73 | return tid |
74 | self <- whoami | 74 | self <- whoami (Just addr) |
75 | sendMessage net addr (wrapQuery meth self addr q) | 75 | sendMessage net addr (wrapQuery meth self addr q) |
76 | mres <- timeout (methodTimeout meth) $ takeMVar mvar | 76 | mres <- timeout (methodTimeout meth) $ takeMVar mvar |
77 | case mres of | 77 | case mres of |
@@ -97,7 +97,7 @@ data Client err meth tid addr x = forall tbl. Client | |||
97 | -- | An action yielding this client\'s own address. It is invoked once | 97 | -- | An action yielding this client\'s own address. It is invoked once |
98 | -- on each outbound and inbound packet. It is valid for this to always | 98 | -- on each outbound and inbound packet. It is valid for this to always |
99 | -- return the same value. | 99 | -- return the same value. |
100 | , clientAddress :: IO addr | 100 | , clientAddress :: Maybe addr -> IO addr |
101 | -- | Transform a query /tid/ value to an appropriate response /tid/ | 101 | -- | Transform a query /tid/ value to an appropriate response /tid/ |
102 | -- value. Normally, this would be the identity transformation, but if | 102 | -- value. Normally, this would be the identity transformation, but if |
103 | -- /tid/ includes a unique cryptographic nonce, then it should be | 103 | -- /tid/ includes a unique cryptographic nonce, then it should be |
@@ -351,7 +351,7 @@ handleMessage (Client net d err pending whoami responseID) again = do | |||
351 | IsQuery meth tid -> case lookupHandler d meth of | 351 | IsQuery meth tid -> case lookupHandler d meth of |
352 | Nothing -> reportMissingHandler err meth addr plain | 352 | Nothing -> reportMissingHandler err meth addr plain |
353 | Just m -> do | 353 | Just m -> do |
354 | self <- whoami | 354 | self <- whoami (Just addr) |
355 | tid' <- responseID tid | 355 | tid' <- responseID tid |
356 | either (reportParseError err) | 356 | either (reportParseError err) |
357 | (>>= sendMessage net addr) | 357 | (>>= sendMessage net addr) |