fixed unaligned disk access for unbuffered I/O in windows

This commit is contained in:
Arvid Norberg 2011-06-17 15:10:40 +00:00
parent 67b79cdd69
commit 1b5ee819cd
2 changed files with 8 additions and 4 deletions

View File

@ -87,6 +87,7 @@
incoming connection
* added more detailed instrumentation of the disk I/O thread
* fixed unaligned disk access for unbuffered I/O in windows
* support torrents whose name is empty
* fixed connection limit to take web seeds into account as well
* fixed bug when receiving a have message before having the metadata

View File

@ -1149,7 +1149,7 @@ namespace libtorrent
if (ReadFileScatter(m_file_handle, segment_array, size, 0, &ol) == 0)
{
DWORD last_error = GetLastError();
if (last_error != ERROR_IO_PENDING)
if (last_error != ERROR_IO_PENDING && last_error != ERROR_HANDLE_EOF)
{
ec.assign(GetLastError(), get_system_category());
CloseHandle(ol.hEvent);
@ -1157,9 +1157,12 @@ namespace libtorrent
}
if (GetOverlappedResult(m_file_handle, &ol, &ret, true) == 0)
{
ec.assign(GetLastError(), get_system_category());
CloseHandle(ol.hEvent);
return -1;
if (GetLastError() != ERROR_HANDLE_EOF)
{
ec.assign(GetLastError(), get_system_category());
CloseHandle(ol.hEvent);
return -1;
}
}
}
CloseHandle(ol.hEvent);