Skip to content

Commit

Permalink
Add SSL on_connect_error
Browse files Browse the repository at this point in the history
  • Loading branch information
uNetworkingAB committed Feb 14, 2021
1 parent 306b9b8 commit e8990f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/crypto/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,10 +677,15 @@ void us_internal_ssl_socket_context_on_timeout(struct us_internal_ssl_socket_con
us_socket_context_on_timeout(0, (struct us_socket_context_t *) context, (struct us_socket_t *(*)(struct us_socket_t *)) on_timeout);
}

/* 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 */
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 *)) {
us_socket_context_on_end(0, (struct us_socket_context_t *) context, (struct us_socket_t *(*)(struct us_socket_t *)) ssl_on_end);
}

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)) {
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);
}

void *us_internal_ssl_socket_context_ext(struct us_internal_ssl_socket_context_t *context) {
return context + 1;
}
Expand Down
3 changes: 3 additions & 0 deletions src/internal/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ void us_internal_ssl_socket_context_on_timeout(struct us_internal_ssl_socket_con
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 *s));

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 *s, int code));

struct us_listen_socket_t *us_internal_ssl_socket_context_listen(struct us_internal_ssl_socket_context_t *context,
const char *host, int port, int options, int socket_ext_size);

Expand Down

0 comments on commit e8990f6

Please sign in to comment.