summaryrefslogtreecommitdiff
path: root/vio
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2009-12-12 23:38:59 +0300
committerAlexander Nozdrin <alik@sun.com>2009-12-12 23:38:59 +0300
commitbc2d4e620ac81824b2e30bf8a1c92e164717b2e1 (patch)
tree2a2432e481d124691d9fa4b39d8a192264178bd1 /vio
parentbd1f8f5bfaf9748ca445401687cca97a89e0dfee (diff)
parent69cfd5c8ecd20bca0e651efcbb8b5affc24c1af4 (diff)
downloadmariadb-git-bc2d4e620ac81824b2e30bf8a1c92e164717b2e1.tar.gz
Manual merge from mysql-trunk-merge.
Conflicts: - extra/comp_err.c - mysql-test/collections/default.experimental - mysql-test/r/archive.result - mysql-test/r/select.result - mysql-test/suite/binlog/r/binlog_unsafe.result - mysql-test/suite/binlog/t/binlog_unsafe.test - mysql-test/suite/rpl/t/disabled.def - mysql-test/t/archive.test - mysql-test/t/select.test - sql/item.cc - sql/item.h - sql/item_timefunc.cc - sql/sql_base.cc - sql/sql_delete.cc - sql/sql_load.cc - sql/sql_partition.cc - sql/sql_table.cc - storage/innobase/handler/ha_innodb.cc - vio/vio.c
Diffstat (limited to 'vio')
-rw-r--r--vio/vio.c42
-rw-r--r--vio/viosocket.c49
-rw-r--r--vio/viosslfactories.c1
3 files changed, 48 insertions, 44 deletions
diff --git a/vio/vio.c b/vio/vio.c
index b7bac69fc3c..73dd68b938f 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -86,10 +86,8 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio->timeout=vio_win32_timeout;
/* Set default timeout */
- vio->read_timeout_millis = INFINITE;
- vio->write_timeout_millis = INFINITE;
-
- memset(&(vio->pipe_overlapped), 0, sizeof(OVERLAPPED));
+ vio->read_timeout_ms= INFINITE;
+ vio->write_timeout_ms= INFINITE;
vio->pipe_overlapped.hEvent= CreateEvent(NULL, TRUE, FALSE, NULL);
DBUG_VOID_RETURN;
}
@@ -116,8 +114,8 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
/* Currently, shared memory is on Windows only, hence the below is ok*/
vio->timeout= vio_win32_timeout;
/* Set default timeout */
- vio->read_timeout_millis= INFINITE;
- vio->write_timeout_millis= INFINITE;
+ vio->read_timeout_ms= INFINITE;
+ vio->write_timeout_ms= INFINITE;
DBUG_VOID_RETURN;
}
#endif
@@ -142,23 +140,21 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
DBUG_VOID_RETURN;
}
#endif /* HAVE_OPENSSL */
- {
- vio->viodelete =vio_delete;
- vio->vioerrno =vio_errno;
- vio->read= (flags & VIO_BUFFERED_READ) ? vio_read_buff : vio_read;
- vio->write =vio_write;
- vio->fastsend =vio_fastsend;
- vio->viokeepalive =vio_keepalive;
- vio->should_retry =vio_should_retry;
- vio->was_interrupted=vio_was_interrupted;
- vio->vioclose =vio_close;
- vio->peer_addr =vio_peer_addr;
- vio->vioblocking =vio_blocking;
- vio->is_blocking =vio_is_blocking;
- vio->timeout =vio_timeout;
- vio->poll_read =vio_poll_read;
- vio->is_connected =vio_is_connected;
- }
+ vio->viodelete =vio_delete;
+ vio->vioerrno =vio_errno;
+ vio->read= (flags & VIO_BUFFERED_READ) ? vio_read_buff : vio_read;
+ vio->write =vio_write;
+ vio->fastsend =vio_fastsend;
+ vio->viokeepalive =vio_keepalive;
+ vio->should_retry =vio_should_retry;
+ vio->was_interrupted =vio_was_interrupted;
+ vio->vioclose =vio_close;
+ vio->peer_addr =vio_peer_addr;
+ vio->vioblocking =vio_blocking;
+ vio->is_blocking =vio_is_blocking;
+ vio->timeout =vio_timeout;
+ vio->poll_read =vio_poll_read;
+ vio->is_connected =vio_is_connected;
DBUG_VOID_RETURN;
}
diff --git a/vio/viosocket.c b/vio/viosocket.c
index fb272a430b9..484eb44fe63 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -707,14 +707,14 @@ void vio_timeout(Vio *vio, uint which, uint timeout)
/*
Finish pending IO on pipe. Honor wait timeout
*/
-static int pipe_complete_io(Vio* vio, char* buf, size_t size, DWORD timeout_millis)
+static size_t pipe_complete_io(Vio* vio, char* buf, size_t size, DWORD timeout_ms)
{
DWORD length;
DWORD ret;
DBUG_ENTER("pipe_complete_io");
- ret= WaitForSingleObject(vio->pipe_overlapped.hEvent, timeout_millis);
+ ret= WaitForSingleObject(vio->pipe_overlapped.hEvent, timeout_ms);
/*
WaitForSingleObjects will normally return WAIT_OBJECT_O (success, IO completed)
or WAIT_TIMEOUT.
@@ -723,14 +723,14 @@ static int pipe_complete_io(Vio* vio, char* buf, size_t size, DWORD timeout_mill
{
CancelIo(vio->hPipe);
DBUG_PRINT("error",("WaitForSingleObject() returned %d", ret));
- DBUG_RETURN(-1);
+ DBUG_RETURN((size_t)-1);
}
if (!GetOverlappedResult(vio->hPipe,&(vio->pipe_overlapped),&length, FALSE))
{
DBUG_PRINT("error",("GetOverlappedResult() returned last error %d",
GetLastError()));
- DBUG_RETURN(-1);
+ DBUG_RETURN((size_t)-1);
}
DBUG_RETURN(length);
@@ -740,49 +740,58 @@ static int pipe_complete_io(Vio* vio, char* buf, size_t size, DWORD timeout_mill
size_t vio_read_pipe(Vio * vio, uchar *buf, size_t size)
{
DWORD bytes_read;
+ size_t retval;
DBUG_ENTER("vio_read_pipe");
DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u", vio->sd, (long) buf,
(uint) size));
- if (!ReadFile(vio->hPipe, buf, (DWORD)size, &bytes_read,
+ if (ReadFile(vio->hPipe, buf, (DWORD)size, &bytes_read,
&(vio->pipe_overlapped)))
{
+ retval= bytes_read;
+ }
+ else
+ {
if (GetLastError() != ERROR_IO_PENDING)
{
DBUG_PRINT("error",("ReadFile() returned last error %d",
GetLastError()));
DBUG_RETURN((size_t)-1);
}
- bytes_read= pipe_complete_io(vio, buf, size,vio->read_timeout_millis);
+ retval= pipe_complete_io(vio, buf, size,vio->read_timeout_ms);
}
- DBUG_PRINT("exit", ("%d", bytes_read));
- DBUG_RETURN(bytes_read);
+ DBUG_PRINT("exit", ("%lld", (longlong)retval));
+ DBUG_RETURN(retval);
}
size_t vio_write_pipe(Vio * vio, const uchar* buf, size_t size)
{
DWORD bytes_written;
+ size_t retval;
DBUG_ENTER("vio_write_pipe");
DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u", vio->sd, (long) buf,
(uint) size));
- if (!WriteFile(vio->hPipe, buf, (DWORD)size, &bytes_written,
+ if (WriteFile(vio->hPipe, buf, (DWORD)size, &bytes_written,
&(vio->pipe_overlapped)))
{
+ retval= bytes_written;
+ }
+ else
+ {
if (GetLastError() != ERROR_IO_PENDING)
{
DBUG_PRINT("vio_error",("WriteFile() returned last error %d",
GetLastError()));
DBUG_RETURN((size_t)-1);
}
- bytes_written = pipe_complete_io(vio, (char *)buf, size,
- vio->write_timeout_millis);
+ retval= pipe_complete_io(vio, (char *)buf, size, vio->write_timeout_ms);
}
- DBUG_PRINT("exit", ("%d", bytes_written));
- DBUG_RETURN(bytes_written);
+ DBUG_PRINT("exit", ("%lld", (longlong)retval));
+ DBUG_RETURN(retval);
}
@@ -817,21 +826,21 @@ int vio_close_pipe(Vio * vio)
void vio_win32_timeout(Vio *vio, uint which , uint timeout_sec)
{
- DWORD timeout_millis;
+ DWORD timeout_ms;
/*
Windows is measuring timeouts in milliseconds. Check for possible int
overflow.
*/
if (timeout_sec > UINT_MAX/1000)
- timeout_millis= INFINITE;
+ timeout_ms= INFINITE;
else
- timeout_millis= timeout_sec * 1000;
+ timeout_ms= timeout_sec * 1000;
/* which == 1 means "write", which == 0 means "read".*/
if(which)
- vio->write_timeout_millis= timeout_millis;
+ vio->write_timeout_ms= timeout_ms;
else
- vio->read_timeout_millis= timeout_millis;
+ vio->read_timeout_ms= timeout_ms;
}
@@ -866,7 +875,7 @@ size_t vio_read_shared_memory(Vio * vio, uchar* buf, size_t size)
WAIT_ABANDONED_0 and WAIT_TIMEOUT - fail. We can't read anything
*/
if (WaitForMultipleObjects(array_elements(events), events, FALSE,
- vio->read_timeout_millis) != WAIT_OBJECT_0)
+ vio->read_timeout_ms) != WAIT_OBJECT_0)
{
DBUG_RETURN(-1);
};
@@ -923,7 +932,7 @@ size_t vio_write_shared_memory(Vio * vio, const uchar* buf, size_t size)
while (remain != 0)
{
if (WaitForMultipleObjects(array_elements(events), events, FALSE,
- vio->write_timeout_millis) != WAIT_OBJECT_0)
+ vio->write_timeout_ms) != WAIT_OBJECT_0)
{
DBUG_RETURN((size_t) -1);
}
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index 51d049b18b9..d0a0a69f70b 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -19,7 +19,6 @@
static my_bool ssl_algorithms_added = FALSE;
static my_bool ssl_error_strings_loaded= FALSE;
-static int verify_depth = 0;
static unsigned char dh512_p[]=
{