-- | Kicks off read/write tasks on a socket
netTask :: MVar Scurry -> MVar () -> IO ()
netTask s _ = do
    sck   <- (readMVar s) >>= prepSocket 
    (r,w) <- spawn sck
    catch (forever idle) $ \e -> do
        let err = show (e :: SomeException)
        netDbg $ "netTask: " ++ err
        throwTo r e
        throwTo w e
    where
        spawn sck = do
            r <- forkIO $ netRead  s sck
            w <- forkIO $ netWrite s sck
            return (r,w)
        idle = do
            delayOneSec
            netDbg "netTask: tick"
netTask :: MVar Scurry -> MVar () -> IO ()
netTask s _ = do
    sck   <- (readMVar s) >>= prepSocket 
    (r,w) <- spawn sck
    catch (forever idle) $ \e -> do
        let err = show (e :: SomeException)
        netDbg $ "netTask: " ++ err
        throwTo r e
        throwTo w e
    where
        spawn sck = do
            r <- forkIO $ netRead  s sck
            w <- forkIO $ netWrite s sck
            return (r,w)
        idle = do
            delayOneSec
            netDbg "netTask: tick"
netTask s _ = do
    sck   <- (readMVar s) >>= prepSocket 
    (r,w) <- spawn sck
    catch (forever idle) $ \e -> do
        let err = show (e :: SomeException)
        netDbg $ "netTask: " ++ err
        throwTo r e
        throwTo w e
    where
        spawn sck = do
            r <- forkIO $ netRead  s sck
            w <- forkIO $ netWrite s sck
            return (r,w)
        idle = do
            delayOneSec
            netDbg "netTask: tick"