mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-17 03:44:34 +03:00
Remove tracing code.
This commit is contained in:
parent
72ef261ebe
commit
2ccf931cb8
@ -28,10 +28,6 @@ data AmesDrv = AmesDrv
|
|||||||
data NetworkMode = Fake | Real
|
data NetworkMode = Fake | Real
|
||||||
deriving (Eq, Ord, Show)
|
deriving (Eq, Ord, Show)
|
||||||
|
|
||||||
-- data GalaxyInfo = GalaxyInfo { ip :: Ipv4, age :: Time.Unix }
|
|
||||||
-- deriving (Eq, Ord, Show)
|
|
||||||
|
|
||||||
|
|
||||||
-- Utils -----------------------------------------------------------------------
|
-- Utils -----------------------------------------------------------------------
|
||||||
|
|
||||||
galaxyPort :: NetworkMode -> Galaxy -> PortNumber
|
galaxyPort :: NetworkMode -> Galaxy -> PortNumber
|
||||||
@ -145,13 +141,12 @@ ames inst who isFake mPort enqueueEv =
|
|||||||
bindSock = do
|
bindSock = do
|
||||||
let ourPort = maybe (listenPort netMode who) fromIntegral mPort
|
let ourPort = maybe (listenPort netMode who) fromIntegral mPort
|
||||||
s <- io $ socket AF_INET Datagram defaultProtocol
|
s <- io $ socket AF_INET Datagram defaultProtocol
|
||||||
|
|
||||||
logTrace $ displayShow ("(ames) Binding to port ", ourPort)
|
logTrace $ displayShow ("(ames) Binding to port ", ourPort)
|
||||||
-- localhost may be wrong here; ames.c switches between INADDR_ANY and
|
|
||||||
-- INADDR_LOOPBACK based on networking flags.
|
|
||||||
let addr = SockAddrInet ourPort $
|
let addr = SockAddrInet ourPort $
|
||||||
if isFake then localhost else inaddrAny
|
if isFake then localhost else inaddrAny
|
||||||
|
|
||||||
() <- io $ bind s addr
|
() <- io $ bind s addr
|
||||||
|
|
||||||
pure s
|
pure s
|
||||||
|
|
||||||
waitPacket :: Socket -> RIO e ()
|
waitPacket :: Socket -> RIO e ()
|
||||||
@ -175,14 +170,10 @@ ames inst who isFake mPort enqueueEv =
|
|||||||
sendPacket :: AmesDrv -> NetworkMode -> AmesDest -> ByteString -> RIO e ()
|
sendPacket :: AmesDrv -> NetworkMode -> AmesDest -> ByteString -> RIO e ()
|
||||||
|
|
||||||
sendPacket AmesDrv{..} Fake dest bs = do
|
sendPacket AmesDrv{..} Fake dest bs = do
|
||||||
logTrace $ displayShow
|
|
||||||
("(ames) sendPacket Fake ", dest, (destSockAddr Fake dest))
|
|
||||||
when (okayFakeAddr dest) $ do
|
when (okayFakeAddr dest) $ do
|
||||||
atomically $ writeTQueue aSendingQueue ((destSockAddr Fake dest), bs)
|
atomically $ writeTQueue aSendingQueue ((destSockAddr Fake dest), bs)
|
||||||
|
|
||||||
sendPacket AmesDrv{..} Real (ADGala wen galaxy) bs = do
|
sendPacket AmesDrv{..} Real (ADGala wen galaxy) bs = do
|
||||||
logTrace $ displayShow
|
|
||||||
("(ames) sendPacket Real Galaxy ", galaxy)
|
|
||||||
galaxies <- readIORef aGalaxies
|
galaxies <- readIORef aGalaxies
|
||||||
queue <- case M.lookup galaxy galaxies of
|
queue <- case M.lookup galaxy galaxies of
|
||||||
Just (_, queue) -> pure queue
|
Just (_, queue) -> pure queue
|
||||||
@ -196,7 +187,6 @@ ames inst who isFake mPort enqueueEv =
|
|||||||
|
|
||||||
sendPacket AmesDrv{..} Real (ADIpv4 _ p a) bs = do
|
sendPacket AmesDrv{..} Real (ADIpv4 _ p a) bs = do
|
||||||
let addr = SockAddrInet (fromIntegral p) (unIpv4 a)
|
let addr = SockAddrInet (fromIntegral p) (unIpv4 a)
|
||||||
logTrace $ displayShow ("(ames) sendPacket Real Other ", addr)
|
|
||||||
atomically $ writeTQueue aSendingQueue (addr, bs)
|
atomically $ writeTQueue aSendingQueue (addr, bs)
|
||||||
|
|
||||||
-- An outbound queue of messages. We can only write to a socket from one
|
-- An outbound queue of messages. We can only write to a socket from one
|
||||||
@ -208,7 +198,6 @@ ames inst who isFake mPort enqueueEv =
|
|||||||
logTrace $ displayShow ("(ames) Sending packet to ", socket, dest)
|
logTrace $ displayShow ("(ames) Sending packet to ", socket, dest)
|
||||||
-- This line blocks! WTF!
|
-- This line blocks! WTF!
|
||||||
bytesSent <- io $ sendTo socket bs dest
|
bytesSent <- io $ sendTo socket bs dest
|
||||||
logTrace $ displayShow ("(ames) Packet sent! ", bytesSent)
|
|
||||||
let len = BS.length bs
|
let len = BS.length bs
|
||||||
when (bytesSent /= len) $ do
|
when (bytesSent /= len) $ do
|
||||||
logDebug $ displayShow
|
logDebug $ displayShow
|
||||||
@ -284,5 +273,4 @@ ames inst who isFake mPort enqueueEv =
|
|||||||
|
|
||||||
queueSendToGalaxy :: SockAddr -> ByteString -> RIO e ()
|
queueSendToGalaxy :: SockAddr -> ByteString -> RIO e ()
|
||||||
queueSendToGalaxy inet packet = do
|
queueSendToGalaxy inet packet = do
|
||||||
logTrace $ displayShow ("(ames) Sending galaxy packet to ", inet)
|
|
||||||
atomically $ writeTQueue outgoing (inet, packet)
|
atomically $ writeTQueue outgoing (inet, packet)
|
||||||
|
Loading…
Reference in New Issue
Block a user