summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-07-11 13:03:13 -0400
committerjoe <joe@jerkface.net>2017-07-11 13:03:13 -0400
commit42c7e85689505fc719088c613f1dc4bc52752643 (patch)
treeadc95338fd4eb4add227a2fc54e8e257bff9b1b1
parentc8752be4ae1b9480a39c7a89bbdcb118d381fbaf (diff)
Added DHT name to listener thread label.
-rw-r--r--examples/dhtd.hs1
-rw-r--r--src/Network/BitTorrent/DHT.hs1
-rw-r--r--src/Network/DatagramServer.hs7
3 files changed, 7 insertions, 2 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index 15db79ea..ab256831 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -167,6 +167,7 @@ godht ::
167 , Pretty (NodeInfo dht IPv4 u) 167 , Pretty (NodeInfo dht IPv4 u)
168 , Default u 168 , Default u
169 , Show u 169 , Show u
170 , Typeable dht
170 ) => String -> (NodeAddr IPv4 -> NodeId dht -> DHT raw dht u IPv4 b) -> IO b 171 ) => String -> (NodeAddr IPv4 -> NodeId dht -> DHT raw dht u IPv4 b) -> IO b
171godht p f = do 172godht p f = do
172 a <- btBindAddr p False 173 a <- btBindAddr p False
diff --git a/src/Network/BitTorrent/DHT.hs b/src/Network/BitTorrent/DHT.hs
index b130e727..1a67c7c4 100644
--- a/src/Network/BitTorrent/DHT.hs
+++ b/src/Network/BitTorrent/DHT.hs
@@ -124,6 +124,7 @@ dht ::
124 , WireFormat raw dht 124 , WireFormat raw dht
125 , Show u 125 , Show u
126 , Default u 126 , Default u
127 , Typeable dht
127 ) 128 )
128 => Options -- ^ normally you need to use 'Data.Default.def'; 129 => Options -- ^ normally you need to use 'Data.Default.def';
129 -> NodeAddr ip -- ^ address to bind this node; 130 -> NodeAddr ip -- ^ address to bind this node;
diff --git a/src/Network/DatagramServer.hs b/src/Network/DatagramServer.hs
index 55a26e58..891417d4 100644
--- a/src/Network/DatagramServer.hs
+++ b/src/Network/DatagramServer.hs
@@ -375,6 +375,7 @@ queryK mgr@Manager{..} dest params kont = do
375 Method meth = method :: Method msg a b 375 Method meth = method :: Method msg a b
376 signature = querySignature meth tid addr 376 signature = querySignature meth tid addr
377 logMsg 'D' "query.sending" signature 377 logMsg 'D' "query.sending" signature
378 -- [Debug#query.sending] &MessageType 0 #312020202020202020202020202020202020202020202020 @77.37.142.179:33445
378 379
379 mres <- liftIO $ do 380 mres <- liftIO $ do
380 ares <- registerQuery (tid, addr) pendingCalls 381 ares <- registerQuery (tid, addr) pendingCalls
@@ -591,15 +592,17 @@ listener mgr@Manager{..} hs p = do
591 592
592-- | Should be run before any 'query', otherwise they will never 593-- | Should be run before any 'query', otherwise they will never
593-- succeed. 594-- succeed.
594listen :: ( WireFormat raw msg 595listen :: forall raw msg.
596 ( WireFormat raw msg
595 , Ord (TransactionID msg) 597 , Ord (TransactionID msg)
596 , Eq (QueryMethod msg) 598 , Eq (QueryMethod msg)
597 , Show (QueryMethod msg) 599 , Show (QueryMethod msg)
598 , Serialize (TransactionID msg) 600 , Serialize (TransactionID msg)
601 , Typeable msg
599 ) => Manager raw msg -> [Handler IO msg raw] -> Protocol raw msg -> IO () 602 ) => Manager raw msg -> [Handler IO msg raw] -> Protocol raw msg -> IO ()
600listen mgr@Manager{..} hs p = do 603listen mgr@Manager{..} hs p = do
601 tid <- fork $ do 604 tid <- fork $ do
602 myThreadId >>= liftIO . flip labelThread "KRPC.listen" 605 myThreadId >>= liftIO . flip labelThread ("KRPC.listen." ++ (L.last $ L.words $ show $ typeOf (Proxy :: Proxy msg)))
603 listener mgr hs p `Lifted.finally` 606 listener mgr hs p `Lifted.finally`
604 liftIO (takeMVar listenerThread) 607 liftIO (takeMVar listenerThread)
605 liftIO $ putMVar listenerThread tid 608 liftIO $ putMVar listenerThread tid