[System] Fixes socket async exception.
authorMarcos Henrich <marcos.henrich@xamarin.com>
Tue, 31 May 2016 15:22:33 +0000 (16:22 +0100)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Wed, 1 Jun 2016 14:08:05 +0000 (15:08 +0100)
commit069388458062a13d78eafa356f96860150d8d583
treee962b8ebedcbea6f756d764335fa381b1635cce3
parentd76164a203f08629b398aa3be64e1f9a49814458
[System] Fixes socket async exception.

SendAsyncFile uses StartSocketServer to start a server and at the same
time begins to accept a client socket. The issue is that when
the accept callback is called SendAsyncFile already closed the socket.

Fixed race condition by moving StartSocketServer and ReceiveCallback
logic into SendAsyncFile, and by using a new MRE to ensure that the
client receives all the data before the server is closed.

Fixes #41264
mcs/class/System/Test/System.Net.Sockets/SocketTest.cs