diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2000-10-12 01:50:33 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2000-10-12 01:50:33 +0000 |
commit | 924046ce75ae5d5ee763f7cff77854bb493814c0 (patch) | |
tree | 78f6182654c22fb21c1932bfd58f27aa06041d58 /crypto/bio | |
parent | 9e2c0f41d7deb0d80be53eed75bfe79f24467ec3 (diff) |
Make non blocking I/O work for accept BIOs.
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/b_sock.c | 1 | ||||
-rw-r--r-- | crypto/bio/bio.h | 4 | ||||
-rw-r--r-- | crypto/bio/bss_acpt.c | 12 |
3 files changed, 16 insertions, 1 deletions
diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c index e971a07de0..da2ff2900f 100644 --- a/crypto/bio/b_sock.c +++ b/crypto/bio/b_sock.c @@ -661,6 +661,7 @@ int BIO_accept(int sock, char **addr) ret=accept(sock,(struct sockaddr *)&from,(void *)&len); if (ret == INVALID_SOCKET) { + if(BIO_sock_should_retry(ret)) return -2; SYSerr(SYS_F_ACCEPT,get_last_socket_error()); BIOerr(BIO_F_BIO_ACCEPT,BIO_R_ACCEPT_ERROR); goto end; diff --git a/crypto/bio/bio.h b/crypto/bio/bio.h index 97003b503c..c15f5e55ff 100644 --- a/crypto/bio/bio.h +++ b/crypto/bio/bio.h @@ -179,7 +179,7 @@ extern "C" { #define BIO_retry_type(a) ((a)->flags & BIO_FLAGS_RWS) #define BIO_should_retry(a) ((a)->flags & BIO_FLAGS_SHOULD_RETRY) -/* The next two are used in conjunction with the +/* The next three are used in conjunction with the * BIO_should_io_special() condition. After this returns true, * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO * stack and return the 'reason' for the special and the offending BIO. @@ -188,6 +188,8 @@ extern "C" { #define BIO_RR_SSL_X509_LOOKUP 0x01 /* Returned from the connect BIO when a connect would have blocked */ #define BIO_RR_CONNECT 0x02 +/* Returned from the accept BIO when an accept would have blocked */ +#define BIO_RR_ACCEPT 0x03 /* These are passed by the BIO callback */ #define BIO_CB_FREE 0x01 diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c index 4da5822062..0c440fbb5f 100644 --- a/crypto/bio/bss_acpt.c +++ b/crypto/bio/bss_acpt.c @@ -236,8 +236,20 @@ again: c->state=ACPT_S_OK; goto again; } + BIO_clear_retry_flags(b); + b->retry_reason=0; i=BIO_accept(c->accept_sock,&(c->addr)); + + /* -2 return means we should retry */ + if(i == -2) + { + BIO_set_retry_special(b); + b->retry_reason=BIO_RR_ACCEPT; + return -1; + } + if (i < 0) return(i); + bio=BIO_new_socket(i,BIO_CLOSE); if (bio == NULL) goto err; |