|
@@ -520,9 +520,12 @@ safe_or_connection_get_tls_desc(safe_or_connection_t *safe_or_conn,
|
|
|
tor_assert(safe_or_conn != NULL);
|
|
|
tor_assert(buf != NULL);
|
|
|
tor_mutex_acquire(&TO_SAFE_CONN(safe_or_conn)->lock);
|
|
|
- tor_assert(safe_or_conn->tls != NULL);
|
|
|
|
|
|
- tor_tls_get_state_description(safe_or_conn->tls, buf, buf_size);
|
|
|
+ if (safe_or_conn->tls != NULL) {
|
|
|
+ tor_tls_get_state_description(safe_or_conn->tls, buf, buf_size);
|
|
|
+ } else {
|
|
|
+ tor_snprintf(buf, buf_size, "<no tls object>");
|
|
|
+ }
|
|
|
|
|
|
tor_mutex_release(&TO_SAFE_CONN(safe_or_conn)->lock);
|
|
|
}
|
|
@@ -951,7 +954,7 @@ safe_or_connection_read_plaintext(safe_or_connection_t *safe_or_conn)
|
|
|
bytes_read);
|
|
|
}
|
|
|
|
|
|
- log_debug(LD_NET, "OR plaintext read of %ld", (long)bytes_read);
|
|
|
+ log_debug(LD_NET, "OR plaintext read of %zu", bytes_read);
|
|
|
|
|
|
safe_or_connection_decrement_buckets(safe_or_conn, bytes_read, 0);
|
|
|
return E_SUCCESS;
|
|
@@ -971,7 +974,7 @@ safe_or_connection_read_encrypted(safe_or_connection_t *safe_or_conn,
|
|
|
safe_or_connection_max_bytes_can_read(safe_or_conn, use_conn_buckets);
|
|
|
// we may read slightly more than this due to pending TLS bytes
|
|
|
|
|
|
- log_warn(LD_NET, "suggested_bytes_to_read: %ld", suggested_bytes_to_read);
|
|
|
+ log_warn(LD_NET, "suggested_bytes_to_read: %zu", suggested_bytes_to_read);
|
|
|
// TODO: remove this ^^
|
|
|
|
|
|
if (suggested_bytes_to_read == 0) {
|
|
@@ -1013,7 +1016,7 @@ safe_or_connection_read_encrypted(safe_or_connection_t *safe_or_conn,
|
|
|
if (PREDICT_LIKELY(bytes_read < SIZE_MAX)) {
|
|
|
size_t buf_len_diff = buf_datalen(TO_SAFE_CONN(safe_or_conn)->inbuf)-buf_initial_size;
|
|
|
if (bytes_read != buf_len_diff) {
|
|
|
- log_warn(LD_OR, "Doesn't match! bytes_read: %ld, buf_len_diff: %ld",
|
|
|
+ log_warn(LD_OR, "Doesn't match! bytes_read: %zu, buf_len_diff: %zu",
|
|
|
bytes_read, buf_len_diff);
|
|
|
tor_assert_nonfatal_unreached_once();
|
|
|
}
|
|
@@ -1034,8 +1037,8 @@ safe_or_connection_read_encrypted(safe_or_connection_t *safe_or_conn,
|
|
|
size_t tls_bytes_written = 0;
|
|
|
tor_tls_get_n_raw_bytes(safe_or_conn->tls, &tls_bytes_read,
|
|
|
&tls_bytes_written);
|
|
|
- log_warn(LD_NET, "After TLS read of %ld: %ld read, %ld written",
|
|
|
- (long)bytes_read, (long)tls_bytes_read, (long)tls_bytes_written);
|
|
|
+ log_warn(LD_NET, "After TLS read of %zu: %zu read, %zu written",
|
|
|
+ bytes_read, tls_bytes_read, tls_bytes_written);
|
|
|
// TODO: change this back to debug ^^
|
|
|
|
|
|
safe_or_connection_decrement_buckets(safe_or_conn, tls_bytes_read,
|
|
@@ -1058,7 +1061,7 @@ safe_or_connection_write_encrypted(safe_or_connection_t *safe_or_conn,
|
|
|
size_t max_bytes_to_write = \
|
|
|
safe_or_connection_max_bytes_can_write(safe_or_conn, use_conn_buckets);
|
|
|
|
|
|
- log_warn(LD_NET, "max_bytes_to_write: %ld", max_bytes_to_write);
|
|
|
+ log_warn(LD_NET, "max_bytes_to_write: %zu", max_bytes_to_write);
|
|
|
// TODO: remove this ^^
|
|
|
|
|
|
if (max_bytes_to_write == 0) {
|
|
@@ -1105,7 +1108,7 @@ safe_or_connection_write_encrypted(safe_or_connection_t *safe_or_conn,
|
|
|
if (PREDICT_LIKELY(bytes_written < SIZE_MAX)) {
|
|
|
size_t buf_len_diff = buf_initial_size-buf_datalen(TO_SAFE_CONN(safe_or_conn)->outbuf);
|
|
|
if (bytes_written != buf_len_diff) {
|
|
|
- log_warn(LD_OR, "Doesn't match! bytes_written: %ld, buf_len_diff: %ld",
|
|
|
+ log_warn(LD_OR, "Doesn't match! bytes_written: %zu, buf_len_diff: %zu",
|
|
|
bytes_written, buf_len_diff);
|
|
|
tor_assert_nonfatal_unreached_once();
|
|
|
}
|
|
@@ -1130,8 +1133,8 @@ safe_or_connection_write_encrypted(safe_or_connection_t *safe_or_conn,
|
|
|
size_t tls_bytes_written = 0;
|
|
|
tor_tls_get_n_raw_bytes(safe_or_conn->tls, &tls_bytes_read,
|
|
|
&tls_bytes_written);
|
|
|
- log_warn(LD_NET, "After TLS write of %ld: %ld read, %ld written",
|
|
|
- (long)bytes_written, (long)tls_bytes_read, (long)tls_bytes_written);
|
|
|
+ log_warn(LD_NET, "After TLS write of %zu: %zu read, %zu written",
|
|
|
+ bytes_written, tls_bytes_read, tls_bytes_written);
|
|
|
// TODO: change this back to debug ^^
|
|
|
|
|
|
safe_or_connection_decrement_buckets(safe_or_conn, tls_bytes_read,
|
|
@@ -1346,7 +1349,7 @@ safe_or_connection_write_cb(safe_connection_t *safe_conn)
|
|
|
tor_error_t rv = safe_or_connection_check_tcp_connection(safe_or_conn);
|
|
|
if (rv != E_SUCCESS) {
|
|
|
tor_assert(safe_or_connection_update_state(safe_or_conn,
|
|
|
- SAFE_OR_CONN_STATE_CLOSED));
|
|
|
+ SAFE_OR_CONN_STATE_CLOSED) == E_SUCCESS);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -1362,7 +1365,7 @@ safe_or_connection_write_cb(safe_connection_t *safe_conn)
|
|
|
tor_error_t rv = safe_or_connection_tls_handshake(safe_or_conn);
|
|
|
if (rv != E_SUCCESS) {
|
|
|
tor_assert(safe_or_connection_update_state(safe_or_conn,
|
|
|
- SAFE_OR_CONN_STATE_CLOSED));
|
|
|
+ SAFE_OR_CONN_STATE_CLOSED) == E_SUCCESS);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -1387,7 +1390,7 @@ safe_or_connection_write_cb(safe_connection_t *safe_conn)
|
|
|
use_conn_buckets);
|
|
|
if (rv != E_SUCCESS) {
|
|
|
tor_assert(safe_or_connection_update_state(safe_or_conn,
|
|
|
- SAFE_OR_CONN_STATE_CLOSED));
|
|
|
+ SAFE_OR_CONN_STATE_CLOSED) == E_SUCCESS);
|
|
|
}
|
|
|
break;
|
|
|
}
|