accept' :: TCPServer -> IO ()
accept' serv@TCPServer{..} = do
 let counter = _counter + 1
 (conn,_,_) <- accept _sock
 connected <- incr _connected
-- putStrLn $ "connection count: " ++ show connected
 case (connected > _maxConnections && _maxConnections >= 0) of
  True -> do
   disconnect serv conn
   accept' serv
  False -> do
   let client = TCPConnection { _id = 0, _conn = conn }
   hSetBuffering conn NoBuffering
   forkIO $ _cb conn counter `catch` disconnected `finally` disconnect serv conn
   accept' $ serv { _counter = counter }
   where
    disconnected (ex :: IOException) = do
--     hPutStrLn stderr $ "Disconnected"
     return ()
accept' :: TCPServer -> IO ()
accept' serv@TCPServer{..} = do
 let counter = _counter + 1
 (conn,_,_) <- accept _sock
 connected <- incr _connected
-- putStrLn $ "connection count: " ++ show connected
 case (connected > _maxConnections && _maxConnections >= 0) of
  True -> do
   disconnect serv conn
   accept' serv
  False -> do
   let client = TCPConnection { _id = 0, _conn = conn }
   hSetBuffering conn NoBuffering
   forkIO $ _cb conn counter `catch` disconnected `finally` disconnect serv conn
   accept' $ serv { _counter = counter }
   where
    disconnected (ex :: IOException) = do
--     hPutStrLn stderr $ "Disconnected"
     return ()
accept' serv@TCPServer{..} = do
 let counter = _counter + 1
 (conn,_,_) <- accept _sock
 connected <- incr _connected
-- putStrLn $ "connection count: " ++ show connected
 case (connected > _maxConnections && _maxConnections >= 0) of
  True -> do
   disconnect serv conn
   accept' serv
  False -> do
   let client = TCPConnection { _id = 0, _conn = conn }
   hSetBuffering conn NoBuffering
   forkIO $ _cb conn counter `catch` disconnected `finally` disconnect serv conn
   accept' $ serv { _counter = counter }
   where
    disconnected (ex :: IOException) = do
--     hPutStrLn stderr $ "Disconnected"
     return ()