[runtime] Fixed interruptible wapi_sendfile.
authorMarcos Henrich <marcos.henrich@xamarin.com>
Tue, 7 Jun 2016 13:06:53 +0000 (14:06 +0100)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Tue, 7 Jun 2016 13:25:04 +0000 (14:25 +0100)
commit11743177c75c480476fc46d64f2206e8b59a967d
tree04b4102c0c803a35fab63d88b49893fcbc1c22ab
parent91c68de23f5067d000207194466813239cda7866
[runtime] Fixed interruptible wapi_sendfile.

Before closing a socket we try to interrupt and wait for all socket
pending system calls to return. For that we set the socket as non
blocking which makes the system calls to return with EAGAIN\EWOULDBLOCK.

This issue was caught by System.Net.Sockets.SocketTest.SendAsyncFile
that was intermittently failing, we were only able to reproduce it while
running multiple test suites in parallel. We now can say that it only failed when
the the socket was closed and the sendfile was waiting for the OS to
allocate enough resources to send the file.

This was fixed by changing wapi_sendfile to return on EAGAIN.
mono/io-layer/sockets.c