assert valid file handles

i've seen error logs of the type
  SSL_write: Bad file descriptor
and i simply can't nail it, so go for some more drastic measures.
This commit is contained in:
Oswald Buddenhagen 2010-04-05 13:15:57 +02:00
parent 72fd2aafb7
commit 90a38ea810

View File

@ -384,7 +384,10 @@ socket_perror( const char *func, Socket_t *sock, int ret )
static int static int
socket_read( Socket_t *sock, char *buf, int len ) socket_read( Socket_t *sock, char *buf, int len )
{ {
int n = int n;
assert( sock->fd >= 0 );
n =
#if HAVE_LIBSSL #if HAVE_LIBSSL
sock->use_ssl ? SSL_read( sock->ssl, buf, len ) : sock->use_ssl ? SSL_read( sock->ssl, buf, len ) :
#endif #endif
@ -400,7 +403,10 @@ socket_read( Socket_t *sock, char *buf, int len )
static int static int
socket_write( Socket_t *sock, char *buf, int len ) socket_write( Socket_t *sock, char *buf, int len )
{ {
int n = int n;
assert( sock->fd >= 0 );
n =
#if HAVE_LIBSSL #if HAVE_LIBSSL
sock->use_ssl ? SSL_write( sock->ssl, buf, len ) : sock->use_ssl ? SSL_write( sock->ssl, buf, len ) :
#endif #endif