[Haskell-cafe] network-conduit proxy

Alexander V Vershilov alexander.vershilov at gmail.com
Sat Mar 10 10:07:52 CET 2012

As it seems from code runTCPServer registers socket close 
and TCPClient runs it in bracket so all open resources should be
closed. It my last try I add 
  _ <- register $ killThread tId
after forking serverSrc $$ clientSink, to kill outter thread explicilty
otherwise it closes thread with error. 

> Is this the expected behaviour or are resources not being closed?

In 'strace' log it seems that both sockets is closed. So I think that 
computation is closed before reaching the end because src $$ sink closed
with error. If you want to run action at the end you can register it

Alexander V Vershilov

Sat, Mar 10, 2012 at 05:43:12AM +0000, grant wrote
> I've tried running the code with runTCPServer first but I get
>  "recv: invalid argument (Bad file descriptor)" on ubuntu (virtualbox) 
> and when running on windows 
> I get "Network.Socket.ByteString.recv: failed (Unknown error)".
> Also, it seems odd that when I run this code   https://gist.github.com/2010354   
> that it doesn't print "END   serverSrc clientSink". 
> Is this the expected behaviour or are resources not being closed?
> Again the same thing happens when running on Ubuntu.
> {- here is the output ...
> C:\haskell>netproxy4
> START clientSrc serverSink
> START serverSrc clientSink
> END   clientSrc serverSink
> START serverSrc clientSink
> START clientSrc serverSink
> END   clientSrc serverSink
> -}
> Thanks for any ideas.
> Grant
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120310/a7c79e9d/attachment.pgp>

More information about the Haskell-Cafe mailing list