Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCing Socket in the new definition. #301

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Network/Socket/Syscall.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Control.Monad (when)
import Foreign.C.Types (CInt(..))
import Foreign.Marshal.Utils (with)
import Foreign.Ptr (Ptr)
import System.Mem.Weak

#if defined(mingw32_HOST_OS)
import qualified Control.Exception as E
Expand All @@ -18,7 +19,6 @@ import GHC.Conc (asyncDoProc)
import Foreign.C.Error (getErrno, eINTR, eINPROGRESS)
import GHC.Conc (threadWaitWrite)
import GHC.IO (onException)
import Network.Socket.Close
#endif

#ifdef HAVE_ADVANCED_SOCKET_FLAGS
Expand All @@ -27,6 +27,7 @@ import Data.Bits ((.|.))
import Network.Socket.Fcntl
#endif

import Network.Socket.Close
import Network.Socket.Internal
import Network.Socket.Options
import Network.Socket.Types
Expand Down Expand Up @@ -100,6 +101,7 @@ socket family stype protocol = do
setSocketOption s IPv6Only 0 `onException` close s
# endif
#endif
addFinalizer s $ {- putStrLn "Closing socket" >> -} close s
return s

-----------------------------------------------------------------------------
Expand Down