mirror of
https://github.com/sigmasternchen/CFloor
synced 2025-03-15 20:28:56 +00:00
let's try full error handling
This commit is contained in:
parent
3ed9336ea9
commit
04c5fb04bd
1 changed files with 21 additions and 3 deletions
24
src/ssl.c
24
src/ssl.c
|
@ -48,12 +48,30 @@ void* copyFromSslToFd(void* data) {
|
||||||
|
|
||||||
char b;
|
char b;
|
||||||
int r;
|
int r;
|
||||||
while((r = SSL_read(connection->instance, &b, 1)) == 1) {
|
|
||||||
write(connection->_readfd, &b, 1);
|
while(true) {
|
||||||
|
while((r = SSL_read(connection->instance, &b, 1)) == 1) {
|
||||||
|
write(connection->_readfd, &b, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int error = SSL_get_error(connection->instance, r);
|
||||||
|
|
||||||
|
debug("ssl: ssl error: %d", error);
|
||||||
|
|
||||||
|
if (error == SSL_ERROR_ZERO_RETURN) {
|
||||||
|
debug("ssl: no more data can be read");
|
||||||
|
break;
|
||||||
|
} else if (error == SSL_ERROR_WANT_READ || error == SSL_ERROR_WANT_WRITE) {
|
||||||
|
debug("ssl: trying again");
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
warn("ssl: connection had an error");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("ssl: read thread finished %d", r);
|
debug("ssl: read thread finished %d", r);
|
||||||
debug("ssl: ssl error: %s", ERR_error_string(ERR_get_error(), NULL));
|
close(connection->_readfd);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue