internal unsafe SocketError CheckAsyncCallOverlappedResult(SocketError errorCode)
{
if (NetEventSource.IsEnabled) NetEventSource.Info(this, errorCode);
if (errorCode == SocketError.Success || errorCode == SocketError.IOPending)
{
// Ignore cases in which a completion packet will be queued:
// we'll deal with this IO in the callback.
return SocketError.Success;
}
// In the remaining cases a completion packet will NOT be queued:
// we have to call the callback explicitly signaling an error.
ErrorCode = (int)errorCode;
Result = -1;
ReleaseUnmanagedStructures(); // Additional release for the completion that won't happen.
return errorCode;
}
}