Finalisation in "withSocketsDo"
|Reported by:||nobody||Owned by:||nobody|
|Type of failure:||Test Case:|
|Related Tickets:||Differential Revisions:|
I'm using GHC 5.02.2, but I believe this comment still applies. While debugging my socket-using program on a Win98 machine my DNS (or some related part of networking assembly) appears to die after having my custom application throw an exception. I think the following change will fix this: Replace in Network.Socket module: withSocketsDo act = do x <- initWinSock if ( x /= 0 ) then ioError (userError "Failed to initialise WinSock") else do v <- act shutdownWinSock return v ...with... withSocketsDo act = do x <- initWinSock if ( x /= 0 ) then ioError (userError "Failed to initialise WinSock") else act `finally` shutdownWinSock I cannot guarantee that this is the solution to my problem, but when I catch all exceptions within the body of the argument IO action the DNS problem does not arise. Also I doubt the exception utility function "finally" is within scope, this is simply the clearest way to write my fix :) Keep up the good work!
Change History (1)
Note: See TracTickets for help on using tickets.