Skip to content

exception sending file on windows #132

@dannydulai

Description

@dannydulai
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions