Skip to content

Commit e8990f6

Browse files
committed
Add SSL on_connect_error
1 parent 306b9b8 commit e8990f6

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/crypto/openssl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,15 @@ void us_internal_ssl_socket_context_on_timeout(struct us_internal_ssl_socket_con
677677
us_socket_context_on_timeout(0, (struct us_socket_context_t *) context, (struct us_socket_t *(*)(struct us_socket_t *)) on_timeout);
678678
}
679679

680+
/* We do not really listen to passed FIN-handler, we entirely override it with our handler since SSL doesn't really have support for half-closed sockets */
680681
void us_internal_ssl_socket_context_on_end(struct us_internal_ssl_socket_context_t *context, struct us_internal_ssl_socket_t *(*on_end)(struct us_internal_ssl_socket_t *)) {
681682
us_socket_context_on_end(0, (struct us_socket_context_t *) context, (struct us_socket_t *(*)(struct us_socket_t *)) ssl_on_end);
682683
}
683684

685+
void us_internal_ssl_socket_context_on_connect_error(struct us_internal_ssl_socket_context_t *context, struct us_internal_ssl_socket_t *(*on_connect_error)(struct us_internal_ssl_socket_t *, int code)) {
686+
us_socket_context_on_connect_error(0, (struct us_socket_context_t *) context, (struct us_socket_t *(*)(struct us_socket_t *, int)) on_connect_error);
687+
}
688+
684689
void *us_internal_ssl_socket_context_ext(struct us_internal_ssl_socket_context_t *context) {
685690
return context + 1;
686691
}

src/internal/internal.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ void us_internal_ssl_socket_context_on_timeout(struct us_internal_ssl_socket_con
158158
void us_internal_ssl_socket_context_on_end(struct us_internal_ssl_socket_context_t *context,
159159
struct us_internal_ssl_socket_t *(*on_end)(struct us_internal_ssl_socket_t *s));
160160

161+
void us_internal_ssl_socket_context_on_connect_error(struct us_internal_ssl_socket_context_t *context,
162+
struct us_internal_ssl_socket_t *(*on_connect_error)(struct us_internal_ssl_socket_t *s, int code));
163+
161164
struct us_listen_socket_t *us_internal_ssl_socket_context_listen(struct us_internal_ssl_socket_context_t *context,
162165
const char *host, int port, int options, int socket_ext_size);
163166

0 commit comments

Comments
 (0)