<commit_before>{-# LANGUAGE CPP, OverloadedStrings #-}

-- Requires the network-bytestring library.
--
-- Start server and run
--   httperf --server=localhost --port=5002 --uri=/ --num-conns=10000

import Control.Concurrent (forkIO)
import Data.ByteString.Char8 ()
import Network (PortID(..), listenOn)
import Network.Socket (Socket, sClose)
#if 1
import EventSocket (accept, recv, sendAll)
#else
import Network.Socket (accept)
import Network.Socket.ByteString (recv, sendAll)
#endif
import System.Event.Thread (ensureIOManagerIsRunning)

main = do
    ensureIOManagerIsRunning
    sock <- listenOn $ PortNumber 5002
    acceptConnections sock

acceptConnections :: Socket -> IO ()
acceptConnections sock = loop
  where
    loop = do<commit_msg>PongServer: maybe listen on IPv6 as well as v4.<commit_after>{-# LANGUAGE CPP, OverloadedStrings #-}

-- Requires the network-bytestring library.
--
-- Start server and run
--   httperf --server=localhost --port=5002 --uri=/ --num-conns=10000

import Control.Concurrent (forkIO)
import Data.ByteString.Char8 ()
import Network.Socket hiding (accept, recv)
#if 0
import EventSocket (accept, recv, sendAll)
#else
import Network.Socket (accept)
import Network.Socket.ByteString (recv, sendAll)
#endif
import System.Event.Thread (ensureIOManagerIsRunning)

main = do
  ensureIOManagerIsRunning
  let myHints = defaultHints { addrFlags = [AI_PASSIVE] }
  (ai:_) <- getAddrInfo (Just myHints) Nothing (Just "5002")
  sock <- socket (addrFamily ai) (addrSocketType ai) (addrProtocol ai)
  setSocketOption sock ReuseAddr 1
  bindSocket sock (addrAddress ai)
  listen sock 1024
  acceptConnections sock

acceptConnections :: Socket -> IO ()
acceptConnections sock = loop
  where
    loop = do
{'fraction_non_alphanumeric': 0.10712217718587146, 'fraction_numerical': 0.021424435437174292, 'mean_word_length': 4.41692789968652, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5866303', 'n_tokens_mistral': 566, 'n_tokens_neox': 541, 'n_words': 165}