Commit e61ecd1a authored by unknown's avatar unknown

Removed unused code in VIO


vio/viossl.c:
  Removed unused code in VIO
  made sslaccept() and sslconnect() more similar
parent 131a4880
...@@ -102,9 +102,6 @@ my_bool vio_peer_addr(Vio* vio, char *buf); ...@@ -102,9 +102,6 @@ my_bool vio_peer_addr(Vio* vio, char *buf);
void vio_in_addr(Vio *vio, struct in_addr *in); void vio_in_addr(Vio *vio, struct in_addr *in);
/* Return 1 if there is data to be read */
my_bool vio_poll_read(Vio *vio,uint timeout);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
...@@ -122,7 +119,6 @@ my_bool vio_poll_read(Vio *vio,uint timeout); ...@@ -122,7 +119,6 @@ my_bool vio_poll_read(Vio *vio,uint timeout);
#define vio_close(vio) ((vio)->vioclose)(vio) #define vio_close(vio) ((vio)->vioclose)(vio)
#define vio_peer_addr(vio, buf) (vio)->peer_addr(vio, buf) #define vio_peer_addr(vio, buf) (vio)->peer_addr(vio, buf)
#define vio_in_addr(vio, in) (vio)->in_addr(vio, in) #define vio_in_addr(vio, in) (vio)->in_addr(vio, in)
#define vio_poll_read(vio,timeout) (vio)->poll_read(vio,timeout)
#endif /* defined(HAVE_VIO) && !defined(DONT_MAP_VIO) */ #endif /* defined(HAVE_VIO) && !defined(DONT_MAP_VIO) */
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
...@@ -155,9 +151,6 @@ int vio_ssl_errno(Vio *vio); ...@@ -155,9 +151,6 @@ int vio_ssl_errno(Vio *vio);
my_bool vio_ssl_peer_addr(Vio* vio, char *buf); my_bool vio_ssl_peer_addr(Vio* vio, char *buf);
void vio_ssl_in_addr(Vio *vio, struct in_addr *in); void vio_ssl_in_addr(Vio *vio, struct in_addr *in);
/* Return 1 if there is data to be read */
my_bool vio_ssl_poll_read(Vio *vio,uint timeout);
/* Single copy for server */ /* Single copy for server */
struct st_VioSSLAcceptorFd struct st_VioSSLAcceptorFd
{ {
...@@ -227,7 +220,6 @@ struct st_vio ...@@ -227,7 +220,6 @@ struct st_vio
void (*in_addr)(Vio*, struct in_addr*); void (*in_addr)(Vio*, struct in_addr*);
my_bool (*should_retry)(Vio*); my_bool (*should_retry)(Vio*);
int (*vioclose)(Vio*); int (*vioclose)(Vio*);
my_bool (*poll_read)(Vio*,uint);
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
SSL* ssl_; SSL* ssl_;
......
...@@ -60,7 +60,6 @@ void vio_reset(Vio* vio, enum enum_vio_type type, ...@@ -60,7 +60,6 @@ void vio_reset(Vio* vio, enum enum_vio_type type,
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;
vio->poll_read =vio_ssl_poll_read;
vio->vioblocking =vio_blocking; vio->vioblocking =vio_blocking;
vio->is_blocking =vio_is_blocking; vio->is_blocking =vio_is_blocking;
} }
...@@ -77,7 +76,6 @@ void vio_reset(Vio* vio, enum enum_vio_type type, ...@@ -77,7 +76,6 @@ void vio_reset(Vio* vio, enum enum_vio_type type,
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;
vio->poll_read =vio_poll_read;
vio->vioblocking =vio_blocking; vio->vioblocking =vio_blocking;
vio->is_blocking =vio_is_blocking; vio->is_blocking =vio_is_blocking;
} }
......
...@@ -255,32 +255,11 @@ void vio_ssl_in_addr(Vio *vio, struct in_addr *in) ...@@ -255,32 +255,11 @@ void vio_ssl_in_addr(Vio *vio, struct in_addr *in)
} }
/* Return 0 if there is data to be read */
my_bool vio_ssl_poll_read(Vio *vio,uint timeout)
{
#ifndef HAVE_POLL
return 0;
#else
struct pollfd fds;
int res;
DBUG_ENTER("vio_ssl_poll");
fds.fd=vio->sd;
fds.events=POLLIN;
fds.revents=0;
if ((res=poll(&fds,1,(int) timeout*1000)) <= 0)
{
DBUG_RETURN(res < 0 ? 0 : 1); /* Don't return 1 on errors */
}
DBUG_RETURN(fds.revents & POLLIN ? 0 : 1);
#endif
}
void sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* vio, long timeout) void sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* vio, long timeout)
{ {
X509* client_cert;
char *str; char *str;
char buf[1024]; char buf[1024];
X509* client_cert;
DBUG_ENTER("sslaccept"); DBUG_ENTER("sslaccept");
DBUG_PRINT("enter", ("sd=%d ptr=%p", vio->sd,ptr)); DBUG_PRINT("enter", ("sd=%d ptr=%p", vio->sd,ptr));
vio_reset(vio,VIO_TYPE_SSL,vio->sd,0,FALSE); vio_reset(vio,VIO_TYPE_SSL,vio->sd,0,FALSE);
...@@ -339,7 +318,6 @@ void sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* vio, long timeout) ...@@ -339,7 +318,6 @@ void sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* vio, long timeout)
DBUG_ENTER("sslconnect"); DBUG_ENTER("sslconnect");
DBUG_PRINT("enter", ("sd=%d ptr=%p ctx: %p", vio->sd,ptr,ptr->ssl_context_)); DBUG_PRINT("enter", ("sd=%d ptr=%p ctx: %p", vio->sd,ptr,ptr->ssl_context_));
vio_reset(vio,VIO_TYPE_SSL,vio->sd,0,FALSE); vio_reset(vio,VIO_TYPE_SSL,vio->sd,0,FALSE);
vio->ssl_=0; vio->ssl_=0;
vio->open_=FALSE; vio->open_=FALSE;
if (!(vio->ssl_ = SSL_new(ptr->ssl_context_))) if (!(vio->ssl_ = SSL_new(ptr->ssl_context_)))
......
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