ping 0.1.0.3 → 0.1.0.4
raw patch · 4 files changed
+12/−12 lines, 4 filesdep ~posix-api
Dependency ranges changed: posix-api
Files
- ping.cabal +2/−2
- src/Network/Icmp/Ping/Hosts.hs +4/−4
- src/Network/Icmp/Ping/Multihosts.hs +3/−3
- src/Network/Icmp/Ping/Single.hs +3/−3
ping.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: ping-version: 0.1.0.3+version: 0.1.0.4 synopsis: icmp echo requests description: This library provides functions that have similar behavior as the@@ -51,7 +51,7 @@ , base >= 4.11.1 && <5 , ip >= 1.4 , cpu >= 0.1.2- , posix-api >= 0.3 && < 0.4+ , posix-api >= 0.4 && < 0.5 , primitive >= 0.7 && < 0.8 , primitive-addr >= 0.1 && < 0.2 , primitive-containers >= 0.3.1
src/Network/Icmp/Ping/Hosts.hs view
@@ -1,10 +1,11 @@ {-# language BangPatterns #-} {-# language BinaryLiterals #-}+{-# language EmptyCase #-} {-# language LambdaCase #-} {-# language MagicHash #-}+{-# language PatternSynonyms #-} {-# language ScopedTypeVariables #-} {-# language UnboxedTuples #-}-{-# language EmptyCase #-} module Network.Icmp.Ping.Hosts ( hosts@@ -29,7 +30,6 @@ import Foreign.C.Types (CSize(..)) import GHC.Clock (getMonotonicTimeNSec) import GHC.Exts (RealWorld)-import GHC.IO (IO(..)) import Net.Types (IPv4(..),IPv4Range) import Network.Icmp.Common (IcmpException(..)) import Network.Icmp.Marshal (peekIcmpHeaderPayload,peekIcmpHeaderType)@@ -46,8 +46,8 @@ import qualified Data.Primitive as PM import qualified Data.Set.Unboxed as SU import qualified Linux.Socket as SCK-import qualified Posix.Socket as SCK import qualified Net.IPv4 as IPv4+import qualified Posix.Socket as SCK fullPacketSize :: Int fullPacketSize = sizeOfIcmpHeader + 4@@ -120,7 +120,7 @@ -> SU.Set IPv4 -- ^ Hosts -> IO (Either IcmpException (MUU.Map IPv4 Word64)) -- ^ Elapsed nanoseconds for responding hosts hosts !pause !theHosts = do- mask $ \restore -> SCK.uninterruptibleSocket SCK.internet SCK.datagram SCK.icmp >>= \case+ mask $ \restore -> SCK.uninterruptibleSocket SCK.Internet SCK.datagram SCK.icmp >>= \case Left (Errno e) -> pure (Left (IcmpExceptionSocket e)) Right sock -> do durations <- restore
src/Network/Icmp/Ping/Multihosts.hs view
@@ -1,10 +1,11 @@ {-# language BangPatterns #-} {-# language BinaryLiterals #-}+{-# language EmptyCase #-} {-# language LambdaCase #-} {-# language MagicHash #-}+{-# language PatternSynonyms #-} {-# language ScopedTypeVariables #-} {-# language UnboxedTuples #-}-{-# language EmptyCase #-} module Network.Icmp.Ping.Multihosts ( multihosts@@ -23,7 +24,6 @@ import Foreign.C.Types (CSize(..)) import GHC.Clock (getMonotonicTimeNSec) import GHC.Exts (RealWorld)-import GHC.IO (IO(..)) import Net.Types (IPv4(..),IPv4Range) import Network.Icmp.Common (IcmpException(..)) import Network.Icmp.Marshal (peekIcmpHeaderPayload)@@ -121,7 +121,7 @@ -- over the course of the loop's execution. multihosts !pause !successPause' !totalPings !cutoff !theHosts | pause <= 0 || totalPings <= 0 || cutoff <= 0 || SU.null theHosts = pure (Right mempty)- | otherwise = let !successPause = max successPause' 0 in mask $ \restore -> SCK.uninterruptibleSocket SCK.internet SCK.datagram SCK.icmp >>= \case+ | otherwise = let !successPause = max successPause' 0 in mask $ \restore -> SCK.uninterruptibleSocket SCK.Internet SCK.datagram SCK.icmp >>= \case Left (Errno e) -> pure (Left (IcmpExceptionSocket e)) Right sock -> do !now0 <- getMonotonicTimeNSec
src/Network/Icmp/Ping/Single.hs view
@@ -1,9 +1,10 @@ {-# language BangPatterns #-}+{-# language EmptyCase #-} {-# language LambdaCase #-} {-# language MagicHash #-}+{-# language PatternSynonyms #-} {-# language ScopedTypeVariables #-} {-# language UnboxedTuples #-}-{-# language EmptyCase #-} module Network.Icmp.Ping.Single ( host@@ -18,7 +19,6 @@ import Foreign.C.Error (Errno(..),eAGAIN,eWOULDBLOCK,eACCES) import Foreign.C.Types (CSize(..)) import GHC.Clock (getMonotonicTimeNSec)-import GHC.IO (IO(..)) import Net.Types (IPv4(..)) import Network.Icmp.Common (IcmpException(..)) import Network.Icmp.Marshal (peekIcmpHeaderPayload,peekIcmpHeaderType)@@ -49,7 +49,7 @@ -- has a fancy way to display the failure. The user will likely need to -- rerun the program with CAP_NET_RAW or as root or after adjusting -- net.ipv4.ping_group_range with sysctl.- mask $ \restore -> SCK.uninterruptibleSocket SCK.internet SCK.datagram SCK.icmp >>= \case+ mask $ \restore -> SCK.uninterruptibleSocket SCK.Internet SCK.datagram SCK.icmp >>= \case Left (Errno e) -> pure (Left (IcmpExceptionSocket e)) Right sock -> do elapsed <- restore