mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 20:07:17 +00:00
Fixed some bugs in my recently submitted patch series.
This commit is contained in:
parent
b0b3c385e1
commit
ff1f320ac8
|
@ -2487,7 +2487,7 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
iovec = WS_ALLOC ( dwBufferCount * sizeof (struct iovec) );
|
iovec = HeapAlloc (GetProcessHeap(), 0, dwBufferCount * sizeof (struct iovec) );
|
||||||
|
|
||||||
if ( !iovec )
|
if ( !iovec )
|
||||||
{
|
{
|
||||||
|
|
10
files/file.c
10
files/file.c
|
@ -1562,11 +1562,6 @@ static BOOL FILE_ReadFileEx(HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
|
||||||
WARN ( "Couldn't get FD\n" );
|
WARN ( "Couldn't get FD\n" );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if ( ! (flags & FD_FLAG_OVERLAPPED) ) {
|
|
||||||
WARN ( "fd is not overlapped\n" );
|
|
||||||
SetLastError ( ERROR_INVALID_PARAMETER );
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
ovp = (async_fileio*) HeapAlloc(GetProcessHeap(), 0, sizeof (async_fileio));
|
ovp = (async_fileio*) HeapAlloc(GetProcessHeap(), 0, sizeof (async_fileio));
|
||||||
if(!ovp)
|
if(!ovp)
|
||||||
|
@ -1790,11 +1785,6 @@ static BOOL FILE_WriteFileEx(HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
|
||||||
TRACE( "Couldn't get FD\n" );
|
TRACE( "Couldn't get FD\n" );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if ( ! (flags & FD_FLAG_OVERLAPPED) ) {
|
|
||||||
WARN ( "fd is not overlapped\n" );
|
|
||||||
SetLastError ( ERROR_INVALID_PARAMETER );
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
ovp = (async_fileio*) HeapAlloc(GetProcessHeap(), 0, sizeof (async_fileio));
|
ovp = (async_fileio*) HeapAlloc(GetProcessHeap(), 0, sizeof (async_fileio));
|
||||||
if(!ovp)
|
if(!ovp)
|
||||||
|
|
|
@ -389,6 +389,8 @@ static void file_queue_async(struct object *obj, void *ptr, unsigned int status,
|
||||||
|
|
||||||
if ( status == STATUS_PENDING )
|
if ( status == STATUS_PENDING )
|
||||||
{
|
{
|
||||||
|
struct pollfd pfd;
|
||||||
|
|
||||||
if ( !async )
|
if ( !async )
|
||||||
async = create_async ( obj, current, ptr );
|
async = create_async ( obj, current, ptr );
|
||||||
if ( !async )
|
if ( !async )
|
||||||
|
@ -397,6 +399,15 @@ static void file_queue_async(struct object *obj, void *ptr, unsigned int status,
|
||||||
async->status = STATUS_PENDING;
|
async->status = STATUS_PENDING;
|
||||||
if ( !async->q )
|
if ( !async->q )
|
||||||
async_insert( q, async );
|
async_insert( q, async );
|
||||||
|
|
||||||
|
/* Check if the new pending request can be served immediately */
|
||||||
|
pfd.fd = obj->fd;
|
||||||
|
pfd.events = file_get_poll_events ( obj );
|
||||||
|
pfd.revents = 0;
|
||||||
|
poll ( &pfd, 1, 0 );
|
||||||
|
|
||||||
|
if ( pfd.revents )
|
||||||
|
file_poll_event ( obj, pfd.revents );
|
||||||
}
|
}
|
||||||
else if ( async ) destroy_async ( async );
|
else if ( async ) destroy_async ( async );
|
||||||
else set_error ( STATUS_INVALID_PARAMETER );
|
else set_error ( STATUS_INVALID_PARAMETER );
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "wine/port.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -282,6 +283,8 @@ static void serial_queue_async(struct object *obj, void *ptr, unsigned int statu
|
||||||
|
|
||||||
if ( status == STATUS_PENDING )
|
if ( status == STATUS_PENDING )
|
||||||
{
|
{
|
||||||
|
struct pollfd pfd;
|
||||||
|
|
||||||
if ( !async )
|
if ( !async )
|
||||||
async = create_async ( obj, current, ptr );
|
async = create_async ( obj, current, ptr );
|
||||||
if ( !async )
|
if ( !async )
|
||||||
|
@ -293,6 +296,19 @@ static void serial_queue_async(struct object *obj, void *ptr, unsigned int statu
|
||||||
async_add_timeout(async,timeout);
|
async_add_timeout(async,timeout);
|
||||||
async_insert(q, async);
|
async_insert(q, async);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if the new pending request can be served immediately */
|
||||||
|
pfd.fd = obj->fd;
|
||||||
|
pfd.events = serial_get_poll_events ( obj );
|
||||||
|
pfd.revents = 0;
|
||||||
|
poll ( &pfd, 1, 0 );
|
||||||
|
|
||||||
|
if ( pfd.revents )
|
||||||
|
/* serial_poll_event() calls set_select_events() */
|
||||||
|
serial_poll_event ( obj, pfd.revents );
|
||||||
|
else
|
||||||
|
set_select_events ( obj, pfd.events );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if ( async ) destroy_async ( async );
|
else if ( async ) destroy_async ( async );
|
||||||
else set_error ( STATUS_INVALID_PARAMETER );
|
else set_error ( STATUS_INVALID_PARAMETER );
|
||||||
|
|
|
@ -250,7 +250,6 @@ static void sock_poll_event( struct object *obj, int event )
|
||||||
sock->errors[FD_CONNECT_BIT] = sock_error( sock->obj.fd );
|
sock->errors[FD_CONNECT_BIT] = sock_error( sock->obj.fd );
|
||||||
if (debug_level)
|
if (debug_level)
|
||||||
fprintf(stderr, "socket %d connection failure\n", sock->obj.fd);
|
fprintf(stderr, "socket %d connection failure\n", sock->obj.fd);
|
||||||
set_select_events( &sock->obj, -1 );
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (sock->state & FD_WINE_LISTENING)
|
if (sock->state & FD_WINE_LISTENING)
|
||||||
|
@ -269,7 +268,6 @@ static void sock_poll_event( struct object *obj, int event )
|
||||||
sock->pmask |= FD_ACCEPT;
|
sock->pmask |= FD_ACCEPT;
|
||||||
sock->errors[FD_ACCEPT_BIT] = sock_error( sock->obj.fd );
|
sock->errors[FD_ACCEPT_BIT] = sock_error( sock->obj.fd );
|
||||||
sock->hmask |= FD_ACCEPT;
|
sock->hmask |= FD_ACCEPT;
|
||||||
set_select_events( &sock->obj, -1 );
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
@ -335,11 +333,17 @@ static void sock_poll_event( struct object *obj, int event )
|
||||||
if (debug_level)
|
if (debug_level)
|
||||||
fprintf(stderr, "socket %d aborted by error %d, event: %x - removing from select loop\n",
|
fprintf(stderr, "socket %d aborted by error %d, event: %x - removing from select loop\n",
|
||||||
sock->obj.fd, sock->errors[FD_CLOSE_BIT], event);
|
sock->obj.fd, sock->errors[FD_CLOSE_BIT], event);
|
||||||
set_select_events( &sock->obj, -1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sock_reselect( sock );
|
if ( sock->pmask & FD_CLOSE || event & (POLLERR|POLLHUP) )
|
||||||
|
{
|
||||||
|
if ( debug_level )
|
||||||
|
fprintf ( stderr, "removing socket %d from select loop\n", sock->obj.fd );
|
||||||
|
set_select_events( &sock->obj, -1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sock_reselect( sock );
|
||||||
|
|
||||||
/* wake up anyone waiting for whatever just happened */
|
/* wake up anyone waiting for whatever just happened */
|
||||||
if ( sock->pmask & sock->mask || sock->flags & FD_FLAG_OVERLAPPED ) sock_wake_up( sock, event );
|
if ( sock->pmask & sock->mask || sock->flags & FD_FLAG_OVERLAPPED ) sock_wake_up( sock, event );
|
||||||
|
|
Loading…
Reference in a new issue