Commit 2ca1a688 authored by SergeyV@selena's avatar SergeyV@selena

Merge svlasenko@bk-internal.mysql.com:/home/bk/mysql-4.1

into  selena.:H:/MYSQL/src/#05588-mysql-4.1
parents d6f32f13 33c3feda
...@@ -801,6 +801,7 @@ typedef off_t os_off_t; ...@@ -801,6 +801,7 @@ typedef off_t os_off_t;
#define socket_errno WSAGetLastError() #define socket_errno WSAGetLastError()
#define SOCKET_EINTR WSAEINTR #define SOCKET_EINTR WSAEINTR
#define SOCKET_EAGAIN WSAEINPROGRESS #define SOCKET_EAGAIN WSAEINPROGRESS
#define SOCKET_ETIMEDOUT WSAETIMEDOUT
#define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK #define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK
#define SOCKET_ENFILE ENFILE #define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE #define SOCKET_EMFILE EMFILE
...@@ -808,6 +809,7 @@ typedef off_t os_off_t; ...@@ -808,6 +809,7 @@ typedef off_t os_off_t;
#define socket_errno sock_errno() #define socket_errno sock_errno()
#define SOCKET_EINTR SOCEINTR #define SOCKET_EINTR SOCEINTR
#define SOCKET_EAGAIN SOCEINPROGRESS #define SOCKET_EAGAIN SOCEINPROGRESS
#define SOCKET_ETIMEDOUT SOCKET_EINTR
#define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK #define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK
#define SOCKET_ENFILE SOCENFILE #define SOCKET_ENFILE SOCENFILE
#define SOCKET_EMFILE SOCEMFILE #define SOCKET_EMFILE SOCEMFILE
...@@ -817,6 +819,7 @@ typedef off_t os_off_t; ...@@ -817,6 +819,7 @@ typedef off_t os_off_t;
#define closesocket(A) close(A) #define closesocket(A) close(A)
#define SOCKET_EINTR EINTR #define SOCKET_EINTR EINTR
#define SOCKET_EAGAIN EAGAIN #define SOCKET_EAGAIN EAGAIN
#define SOCKET_ETIMEDOUT SOCKET_EINTR
#define SOCKET_EWOULDBLOCK EWOULDBLOCK #define SOCKET_EWOULDBLOCK EWOULDBLOCK
#define SOCKET_ENFILE ENFILE #define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE #define SOCKET_EMFILE EMFILE
......
...@@ -68,6 +68,8 @@ int vio_fastsend(Vio *vio); ...@@ -68,6 +68,8 @@ int vio_fastsend(Vio *vio);
int vio_keepalive(Vio *vio, my_bool onoff); int vio_keepalive(Vio *vio, my_bool onoff);
/* Whenever we should retry the last read/write operation. */ /* Whenever we should retry the last read/write operation. */
my_bool vio_should_retry(Vio *vio); my_bool vio_should_retry(Vio *vio);
/* Check that operation was timed out */
my_bool vio_was_interrupted(Vio *vio);
/* Short text description of the socket for those, who are curious.. */ /* Short text description of the socket for those, who are curious.. */
const char* vio_description(Vio *vio); const char* vio_description(Vio *vio);
/* Return the type of the connection */ /* Return the type of the connection */
...@@ -146,6 +148,7 @@ int vio_close_shared_memory(Vio * vio); ...@@ -146,6 +148,7 @@ int vio_close_shared_memory(Vio * vio);
#define vio_fastsend(vio) (vio)->fastsend(vio) #define vio_fastsend(vio) (vio)->fastsend(vio)
#define vio_keepalive(vio, set_keep_alive) (vio)->viokeepalive(vio, set_keep_alive) #define vio_keepalive(vio, set_keep_alive) (vio)->viokeepalive(vio, set_keep_alive)
#define vio_should_retry(vio) (vio)->should_retry(vio) #define vio_should_retry(vio) (vio)->should_retry(vio)
#define vio_was_interrupted(vio) (vio)->was_interrupted(vio)
#define vio_close(vio) ((vio)->vioclose)(vio) #define vio_close(vio) ((vio)->vioclose)(vio)
#define vio_peer_addr(vio, buf, prt) (vio)->peer_addr(vio, buf, prt) #define vio_peer_addr(vio, buf, prt) (vio)->peer_addr(vio, buf, prt)
#define vio_in_addr(vio, in) (vio)->in_addr(vio, in) #define vio_in_addr(vio, in) (vio)->in_addr(vio, in)
...@@ -188,6 +191,7 @@ struct st_vio ...@@ -188,6 +191,7 @@ struct st_vio
my_bool (*peer_addr)(Vio*, char *, uint16*); my_bool (*peer_addr)(Vio*, char *, uint16*);
void (*in_addr)(Vio*, struct in_addr*); void (*in_addr)(Vio*, struct in_addr*);
my_bool (*should_retry)(Vio*); my_bool (*should_retry)(Vio*);
my_bool (*was_interrupted)(Vio*);
int (*vioclose)(Vio*); int (*vioclose)(Vio*);
void (*timeout)(Vio*, unsigned int which, unsigned int timeout); void (*timeout)(Vio*, unsigned int which, unsigned int timeout);
void *ssl_arg; void *ssl_arg;
......
...@@ -602,7 +602,7 @@ net_safe_read(MYSQL *mysql) ...@@ -602,7 +602,7 @@ net_safe_read(MYSQL *mysql)
DBUG_PRINT("error",("Wrong connection or packet. fd: %s len: %d", DBUG_PRINT("error",("Wrong connection or packet. fd: %s len: %d",
vio_description(net->vio),len)); vio_description(net->vio),len));
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
if (vio_errno(net->vio) == SOCKET_EINTR) if (vio_was_interrupted(net->vio))
return (packet_error); return (packet_error);
#endif /*MYSQL_SERVER*/ #endif /*MYSQL_SERVER*/
end_server(mysql); end_server(mysql);
......
...@@ -759,7 +759,7 @@ my_real_read(NET *net, ulong *complen) ...@@ -759,7 +759,7 @@ my_real_read(NET *net, ulong *complen)
net->error= 2; /* Close socket */ net->error= 2; /* Close socket */
net->report_error= 1; net->report_error= 1;
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
net->last_errno= (interrupted ? ER_NET_READ_INTERRUPTED : net->last_errno= (vio_was_interrupted(net->vio) ? ER_NET_READ_INTERRUPTED :
ER_NET_READ_ERROR); ER_NET_READ_ERROR);
#endif #endif
goto end; goto end;
......
...@@ -50,6 +50,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type, ...@@ -50,6 +50,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type,
vio->fastsend =vio_fastsend; vio->fastsend =vio_fastsend;
vio->viokeepalive =vio_keepalive; vio->viokeepalive =vio_keepalive;
vio->should_retry =vio_should_retry; vio->should_retry =vio_should_retry;
vio->was_interrupted=vio_was_interrupted;
vio->vioclose =vio_close_pipe; vio->vioclose =vio_close_pipe;
vio->peer_addr =vio_peer_addr; vio->peer_addr =vio_peer_addr;
vio->in_addr =vio_in_addr; vio->in_addr =vio_in_addr;
...@@ -69,6 +70,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type, ...@@ -69,6 +70,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type,
vio->fastsend =vio_fastsend; vio->fastsend =vio_fastsend;
vio->viokeepalive =vio_keepalive; vio->viokeepalive =vio_keepalive;
vio->should_retry =vio_should_retry; vio->should_retry =vio_should_retry;
vio->was_interrupted=vio_was_interrupted;
vio->vioclose =vio_close_shared_memory; vio->vioclose =vio_close_shared_memory;
vio->peer_addr =vio_peer_addr; vio->peer_addr =vio_peer_addr;
vio->in_addr =vio_in_addr; vio->in_addr =vio_in_addr;
...@@ -88,6 +90,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type, ...@@ -88,6 +90,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type,
vio->fastsend =vio_ssl_fastsend; vio->fastsend =vio_ssl_fastsend;
vio->viokeepalive =vio_ssl_keepalive; vio->viokeepalive =vio_ssl_keepalive;
vio->should_retry =vio_ssl_should_retry; vio->should_retry =vio_ssl_should_retry;
vio->was_interrupted=vio_ssl_was_interrupted;
vio->vioclose =vio_ssl_close; vio->vioclose =vio_ssl_close;
vio->peer_addr =vio_ssl_peer_addr; vio->peer_addr =vio_ssl_peer_addr;
vio->in_addr =vio_ssl_in_addr; vio->in_addr =vio_ssl_in_addr;
...@@ -105,6 +108,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type, ...@@ -105,6 +108,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type,
vio->fastsend =vio_fastsend; vio->fastsend =vio_fastsend;
vio->viokeepalive =vio_keepalive; vio->viokeepalive =vio_keepalive;
vio->should_retry =vio_should_retry; vio->should_retry =vio_should_retry;
vio->was_interrupted=vio_was_interrupted;
vio->vioclose =vio_close; vio->vioclose =vio_close;
vio->peer_addr =vio_peer_addr; vio->peer_addr =vio_peer_addr;
vio->in_addr =vio_in_addr; vio->in_addr =vio_in_addr;
......
...@@ -39,6 +39,8 @@ int vio_ssl_fastsend(Vio *vio); ...@@ -39,6 +39,8 @@ int vio_ssl_fastsend(Vio *vio);
int vio_ssl_keepalive(Vio *vio, my_bool onoff); int vio_ssl_keepalive(Vio *vio, my_bool onoff);
/* Whenever we should retry the last read/write operation. */ /* Whenever we should retry the last read/write operation. */
my_bool vio_ssl_should_retry(Vio *vio); my_bool vio_ssl_should_retry(Vio *vio);
/* Check that operation was timed out */
my_bool vio_ssl_was_interrupted(Vio *vio);
/* When the workday is over... */ /* When the workday is over... */
int vio_ssl_close(Vio *vio); int vio_ssl_close(Vio *vio);
/* Return last error number */ /* Return last error number */
......
...@@ -196,6 +196,15 @@ vio_should_retry(Vio * vio __attribute__((unused))) ...@@ -196,6 +196,15 @@ vio_should_retry(Vio * vio __attribute__((unused)))
} }
my_bool
vio_was_interrupted(Vio *vio __attribute__((unused)))
{
int en= socket_errno;
return (en == SOCKET_EAGAIN || en == SOCKET_EINTR ||
en == SOCKET_EWOULDBLOCK || en == SOCKET_ETIMEDOUT);
}
int vio_close(Vio * vio) int vio_close(Vio * vio)
{ {
int r=0; int r=0;
......
...@@ -184,6 +184,15 @@ vio_ssl_should_retry(Vio * vio __attribute__((unused))) ...@@ -184,6 +184,15 @@ vio_ssl_should_retry(Vio * vio __attribute__((unused)))
} }
my_bool
vio_ssl_was_interrupted(Vio *vio __attribute__((unused)))
{
int en= socket_errno;
return (en == SOCKET_EAGAIN || en == SOCKET_EINTR ||
en == SOCKET_EWOULDBLOCK || en == SOCKET_ETIMEDOUT);
}
int vio_ssl_close(Vio * vio) int vio_ssl_close(Vio * vio)
{ {
int r; int r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment