jacksonh / manos

Manos is an easy to use, easy to test, high performance web application framework that stays out of your way and makes your life ridiculously simple.
Other
455 stars 61 forks source link

exception sending file on windows #132

Open dannydulai opened 13 years ago

dannydulai commented 13 years ago
Unhandled Exception: System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
   at System.Net.Sockets.Socket.BeginSend(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
   at Manos.IO.Managed.TcpSocket.TcpStream.WriteSingleFragment(ByteBuffer fragment) in c:\cygwin\home\Danny\work\sooloos\Cola\Manos\src\Manos.IO\Manos.IO.Managed\TcpSocket.cs:line 94
   at Manos.IO.FragmentStream`1.WriteCurrentFragment() in c:\cygwin\home\Danny\work\sooloos\Cola\Manos\src\Manos.IO\Manos.IO\FragmentStream.cs:line 431
   at Manos.IO.FragmentStream`1.HandleWrite() in c:\cygwin\home\Danny\work\sooloos\Cola\Manos\src\Manos.IO\Manos.IO\FragmentStream.cs:line 422
   at Manos.IO.Managed.ManagedStream`1.HandleWrite() in c:\cygwin\home\Danny\work\sooloos\Cola\Manos\src\Manos.IO\Manos.IO.Managed\ManagedStream.cs:line 151
   at Manos.IO.Managed.TcpSocket.TcpStream.<>c__DisplayClass18.<WriteCallback>b__17() in c:\cygwin\home\Danny\work\sooloos\Cola\Manos\src\Manos.IO\Manos.IO.Managed\TcpSocket.cs:line 109
   at Manos.IO.Managed.Context.RunOnceNonblocking() in c:\cygwin\home\Danny\work\sooloos\Cola\Manos\src\Manos.IO\Manos.IO.Managed\Context.cs:line 124
   at Manos.IO.Managed.Context.RunOnce() in c:\cygwin\home\Danny\work\sooloos\Cola\Manos\src\Manos.IO\Manos.IO.Managed\Context.cs:line 107
   at Manos.IO.Managed.Context.Start() in c:\cygwin\home\Danny\work\sooloos\Cola\Manos\src\Manos.IO\Manos.IO.Managed\Context.cs:line 100

I boiled it down to this code in HttpStream.cs:

                void SendFileData (string fileName)
                {
                        if (SocketStream is ISendfileCapable) {
                                ((ISendfileCapable) SocketStream).SendFile (fileName);
                        } else {
                                SocketStream.PauseWriting ();
                                var fs = HttpEntity.Context.OpenFile (fileName, OpenMode.Read, 64 * 1024);
                                SocketStream.Write (new StreamCopySequencer (fs, SocketStream, true));
                        }
                        SocketStream.Write (SendCallback (SendBufferedOps));
                }

If I comment out the if() + SendFile(), it works fine.

dannydulai commented 13 years ago

oh, also, if i hit it with chrome15 (dev channel), i get:

Error 321 (net::ERR_INVALID_CHUNKED_ENCODING): Unknown error.