Skip to content

Commit f9850e1

Browse files
committed
1 parent 902e32e commit f9850e1

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

include/h2o.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,6 +2431,8 @@ void h2o_log_register(h2o_hostconf_t *hostconf);
24312431
*/
24322432
void h2o_log_register_configurator(h2o_globalconf_t *conf);
24332433

2434+
PTLS_LOG_DEFINE_GETSNI(h2o_conn, h2o_conn_t *, { return arg->callbacks->get_ssl_server_name(arg); })
2435+
24342436
/* inline defs */
24352437

24362438
#ifdef H2O_NO_64BIT_ATOMICS

include/h2o/socket.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,8 @@ int h2o_socket_boringssl_get_async_job_index(void);
543543
int h2o_socket_boringssl_async_resumption_in_flight(SSL *ssl);
544544
#endif
545545

546+
PTLS_LOG_DEFINE_GETSNI(h2o_sock, h2o_socket_t *, { return h2o_socket_get_ssl_server_name(arg); })
547+
546548
/* inline defs */
547549

548550
inline int h2o_socket_is_writing(h2o_socket_t *sock)

lib/probes_.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
break; \
3333
h2o_socket_t *sock_ = (_sock); \
3434
ptls_log_conn_state_t *conn_state = h2o_socket_log_state(sock_); \
35-
active &= ptls_log_conn_maybe_active(conn_state, (const char *(*)(void *))h2o_socket_get_ssl_server_name, sock_); \
35+
active &= ptls_log_conn_maybe_active(conn_state, ptls_log_getsni_h2o_sock(sock_)); \
3636
if (PTLS_LIKELY(active == 0)) \
3737
break; \
38-
PTLS_LOG__DO_LOG(h2o, _name, conn_state, (const char *(*)(void *))h2o_socket_get_ssl_server_name, sock_, 1, { \
38+
PTLS_LOG__DO_LOG(h2o, _name, conn_state, ptls_log_getsni_h2o_sock(sock_), 1, { \
3939
PTLS_LOG_ELEMENT_PTR(sock, sock_); \
4040
do { \
4141
_block \
@@ -50,10 +50,10 @@
5050
break; \
5151
h2o_conn_t *conn_ = (_conn); \
5252
ptls_log_conn_state_t *conn_state = conn_->callbacks->log_state(conn_); \
53-
active &= ptls_log_conn_maybe_active(conn_state, (const char *(*)(void *))conn_->callbacks->get_ssl_server_name, conn_); \
53+
active &= ptls_log_conn_maybe_active(conn_state, ptls_log_getsni_h2o_conn(conn_)); \
5454
if (active == 0) \
5555
break; \
56-
PTLS_LOG__DO_LOG(h2o, _name, conn_state, (const char *(*)(void *))conn_->callbacks->get_ssl_server_name, conn_, 1, { \
56+
PTLS_LOG__DO_LOG(h2o, _name, conn_state, ptls_log_getsni_h2o_conn(conn_), 1, { \
5757
PTLS_LOG_ELEMENT_UNSIGNED(conn_id, conn_->id); \
5858
do { \
5959
_block \
@@ -174,8 +174,7 @@ static inline void h2o_probe_log_request(h2o_req_t *req, uint64_t req_index)
174174
if (H2O_PROBE_IS_ENABLED(RECEIVE_REQUEST_HEADER) ||
175175
(ptls_log_point_maybe_active(&receive_request_header_logpoint) != 0 &&
176176
(receive_request_header_logpoint.state.active_conns &
177-
ptls_log_conn_maybe_active(req->conn->callbacks->log_state(req->conn),
178-
(const char *(*)(void *))req->conn->callbacks->get_ssl_server_name, req->conn)) != 0)) {
177+
ptls_log_conn_maybe_active(req->conn->callbacks->log_state(req->conn), ptls_log_getsni_h2o_conn(req->conn))) != 0)) {
179178
if (req->input.authority.base != NULL)
180179
h2o_probe_request_header(req, req_index, H2O_TOKEN_AUTHORITY->buf, req->input.authority);
181180
if (req->input.method.base != NULL)
@@ -203,8 +202,7 @@ static inline void h2o_probe_log_response(h2o_req_t *req, uint64_t req_index)
203202
if (H2O_PROBE_IS_ENABLED(SEND_RESPONSE_HEADER) ||
204203
(ptls_log_point_maybe_active(&send_response_header_logpoint) != 0 &&
205204
(send_response_header_logpoint.state.active_conns &
206-
ptls_log_conn_maybe_active(req->conn->callbacks->log_state(req->conn),
207-
(const char *(*)(void *))req->conn->callbacks->get_ssl_server_name, req->conn)) != 0)) {
205+
ptls_log_conn_maybe_active(req->conn->callbacks->log_state(req->conn), ptls_log_getsni_h2o_conn(req->conn))) != 0)) {
208206
if (req->res.content_length != SIZE_MAX) {
209207
char buf[sizeof(H2O_SIZE_T_LONGEST_STR)];
210208
size_t len = (size_t)sprintf(buf, "%zu", req->res.content_length);

0 commit comments

Comments
 (0)