@@ -14,7 +14,7 @@ use windows_sys::Win32::Networking::WinSock::{
1414 getsockopt, setsockopt, AcceptEx , WSAGetLastError , WSARecv , WSASend , WSASocketW ,
1515 INVALID_SOCKET , LPCONDITIONPROC , LPWSAOVERLAPPED_COMPLETION_ROUTINE , SEND_RECV_FLAGS , SOCKADDR ,
1616 SOCKADDR_IN , SOCKET , SOCKET_ERROR , SOL_SOCKET , SO_PROTOCOL_INFO , SO_UPDATE_ACCEPT_CONTEXT ,
17- WSABUF , WSAPROTOCOL_INFOW , WSA_FLAG_OVERLAPPED , WSA_IO_PENDING ,
17+ WSABUF , WSAEINPROGRESS , WSAENETDOWN , WSAPROTOCOL_INFOW , WSA_FLAG_OVERLAPPED , WSA_IO_PENDING ,
1818} ;
1919use windows_sys:: Win32 :: Storage :: FileSystem :: SetFileCompletionNotificationModes ;
2020use windows_sys:: Win32 :: System :: WindowsProgramming :: FILE_SKIP_SET_EVENT_ON_HANDLE ;
@@ -159,7 +159,6 @@ impl<'o> Operator<'o> {
159159 for entry in entries {
160160 let mut cqe = * Box :: from_raw ( entry. lpOverlapped . cast :: < Overlapped > ( ) ) ;
161161 // resolve completed read/write tasks
162- // todo refactor IOCP impl
163162 cqe. result = match cqe. syscall_name {
164163 SyscallName :: accept => {
165164 if setsockopt (
@@ -172,7 +171,7 @@ impl<'o> Operator<'o> {
172171 {
173172 cqe. socket . try_into ( ) . expect ( "result overflow" )
174173 } else {
175- -c_longlong:: from ( windows_sys :: Win32 :: Foundation :: GetLastError ( ) )
174+ -c_longlong:: from ( WSAENETDOWN )
176175 }
177176 }
178177 SyscallName :: recv
@@ -183,7 +182,7 @@ impl<'o> Operator<'o> {
183182 if r > 0 {
184183 r
185184 } else {
186- -c_longlong:: from ( windows_sys :: Win32 :: Foundation :: GetLastError ( ) )
185+ -c_longlong:: from ( WSAEINPROGRESS )
187186 }
188187 }
189188 _ => panic ! ( "unsupported" ) ,
@@ -273,6 +272,7 @@ impl<'o> Operator<'o> {
273272 overlapped. token = user_data;
274273 overlapped. syscall_name = syscall_name;
275274 overlapped. socket = socket;
275+ overlapped. result = -c_longlong:: from ( WSAENETDOWN ) ;
276276 let mut buf: Vec < u8 > = Vec :: with_capacity ( size as usize * 2 ) ;
277277 while AcceptEx (
278278 fd,
@@ -364,6 +364,7 @@ impl<'o> Operator<'o> {
364364 overlapped. from_fd = fd;
365365 overlapped. token = user_data;
366366 overlapped. syscall_name = syscall_name;
367+ overlapped. result = -c_longlong:: from ( WSAEINPROGRESS ) ;
367368 if WSARecv (
368369 fd,
369370 buf,
@@ -457,6 +458,7 @@ impl<'o> Operator<'o> {
457458 overlapped. from_fd = fd;
458459 overlapped. token = user_data;
459460 overlapped. syscall_name = syscall_name;
461+ overlapped. result = -c_longlong:: from ( WSAEINPROGRESS ) ;
460462 if WSASend (
461463 fd,
462464 buf,
0 commit comments