static void on_connect_to_upstream(uv_connect_t *req, int status)
{
struct peer *upstream = (struct peer *)req->handle->data;
- struct tls_proxy_ctx *proxy = get_proxy(upstream);
free(req);
if (status < 0) {
fprintf(stdout, "[upstream] error connecting to upstream (%s): %s\n",
}
fprintf(stdout, "[client] reading %zd bytes from '%s'\n", nread, ip_straddr(&client->addr));
- int res = tls_process_from_client(client, buf->base, nread);
+ int res = tls_process_from_client(client, (const uint8_t *)buf->base, nread);
if (res < 0) {
if (client->state == STATE_CONNECTED) {
client->state = STATE_CLOSING_IN_PROGRESS;
}
return;
}
- int res = tls_process_from_upstream(upstream, buf->base, nread);
+ int res = tls_process_from_upstream(upstream, (const uint8_t *)buf->base, nread);
if (res < 0) {
fprintf(stdout, "[upstream] error processing tls data to client\n");
if (upstream->peer->state == STATE_CONNECTED) {
static int write_to_upstream_pending(struct peer *upstream)
{
- struct tls_proxy_ctx *proxy = get_proxy(upstream);
struct buf *buf = get_first_pending_buf(upstream);
uv_write_t *req = (uv_write_t *) malloc(sizeof(uv_write_t));
uv_buf_t wrbuf = uv_buf_init(buf->buf, buf->size);
ssize_t proxy_gnutls_push(gnutls_transport_ptr_t h, const void *buf, size_t len)
{
struct peer *client = (struct peer *)h;
- struct tls_ctx *t = client->tls;
fprintf(stdout, "[gnutls_push] writing %zd bytes\n", len);
ssize_t ret = -1;
struct tls_proxy_ctx *proxy = get_proxy(client);
struct buf *buf = get_first_pending_buf(client);
- uv_buf_t wrbuf = uv_buf_init(buf->buf, buf->size);
fprintf(stdout, "[client] writing %zd bytes\n", buf->size);
gnutls_session_t tls_session = client->tls->session;
static int tls_process_from_upstream(struct peer *upstream, const uint8_t *buf, ssize_t len)
{
struct peer *client = upstream->peer;
- gnutls_session_t tls_session = client->tls->session;
fprintf(stdout, "[upstream] pushing %zd bytes to client\n", len);
}
bool list_was_empty = (client->pending_buf.len == 0);
- push_to_client_pending(client, buf, len);
+ push_to_client_pending(client, (const char *)buf, len);
submitted = len;
if (client->tls->handshake_state == TLS_HS_DONE) {
if (list_was_empty && client->pending_buf.len > 0) {
struct peer *upstream = client->peer;
if (upstream->state == STATE_CONNECTED) {
bool upstream_pending_is_empty = (upstream->pending_buf.len == 0);
- push_to_upstream_pending(upstream, tls->recv_buf, count);
+ push_to_upstream_pending(upstream, (const char *)tls->recv_buf, count);
if (upstream_pending_is_empty) {
write_to_upstream_pending(upstream);
}
fprintf(stdout, "[client] connecting to upstream '%s'\n", ip_straddr(&upstream->addr));
uv_tcp_connect(conn, &upstream->handle, (struct sockaddr *)&upstream->addr,
on_connect_to_upstream);
- push_to_upstream_pending(upstream, tls->recv_buf, count);
+ push_to_upstream_pending(upstream, (const char *)tls->recv_buf, count);
} else if (upstream->state == STATE_CONNECT_IN_PROGRESS) {
- push_to_upstream_pending(upstream, tls->recv_buf, count);
+ push_to_upstream_pending(upstream, (const char *)tls->recv_buf, count);
}
submitted += count;
}