/* if WANTWRITE last time, we must use the _same_ n as before */
tor_assert(n >= tls->wantwrite_n);
log_fn(LOG_DEBUG,"resuming pending-write, (%d to flush, reusing %d)",
- n, tls->wantwrite_n);
+ (int)n, (int)tls->wantwrite_n);
n = tls->wantwrite_n;
tls->wantwrite_n = 0;
}
*buf_flushlen -= write_result;
buf_remove_from_front(buf, write_result);
log_fn(LOG_DEBUG,"%d: flushed %d bytes, %d ready to flush, %d remain.",
- s,write_result,*buf_flushlen,(int)buf->datalen);
+ s,write_result,(int)*buf_flushlen,(int)buf->datalen);
return write_result;
}
*buf_flushlen -= r;
buf_remove_from_front(buf, r);
log_fn(LOG_DEBUG,"flushed %d bytes, %d ready to flush, %d remain.",
- r,*buf_flushlen,(int)buf->datalen);
+ r,(int)*buf_flushlen,(int)buf->datalen);
return r;
}
assert_buf_ok(buf);
if (buf_ensure_capacity(buf, buf->datalen+string_len)) {
- log_fn(LOG_WARN, "buflen too small, can't hold %d bytes.", (int)buf->datalen+string_len);
+ log_fn(LOG_WARN, "buflen too small, can't hold %d bytes.", (int)(buf->datalen+string_len));
return -1;
}
memcpy(buf->mem+buf->datalen, string, string_len);
buf->datalen += string_len;
- log_fn(LOG_DEBUG,"added %d bytes to buf (now %d total).",string_len, (int)buf->datalen);
+ log_fn(LOG_DEBUG,"added %d bytes to buf (now %d total).",(int)string_len, (int)buf->datalen);
return buf->datalen;
}
body += 4; /* Skip the the CRLFCRLF */
headerlen = body-headers; /* includes the CRLFCRLF */
bodylen = buf->datalen - headerlen;
- log_fn(LOG_DEBUG,"headerlen %d, bodylen %d.", headerlen, bodylen);
+ log_fn(LOG_DEBUG,"headerlen %d, bodylen %d.", (int)headerlen, (int)bodylen);
if(max_headerlen <= headerlen) {
- log_fn(LOG_WARN,"headerlen %d larger than %d. Failing.", headerlen, max_headerlen-1);
+ log_fn(LOG_WARN,"headerlen %d larger than %d. Failing.", (int)headerlen,
+ (int)max_headerlen-1);
return -1;
}
if(max_bodylen <= bodylen) {
- log_fn(LOG_WARN,"bodylen %d larger than %d. Failing.", bodylen, max_bodylen-1);
+ log_fn(LOG_WARN,"bodylen %d larger than %d. Failing.", (int)bodylen, (int)max_bodylen-1);
return -1;
}
}
contentlen = i;
/* if content-length is malformed, then our body length is 0. fine. */
- log_fn(LOG_DEBUG,"Got a contentlen of %d.",contentlen);
+ log_fn(LOG_DEBUG,"Got a contentlen of %d.",(int)contentlen);
if(bodylen < contentlen) {
log_fn(LOG_DEBUG,"body not all here yet.");
return 0; /* not all there yet */
}
if(bodylen > contentlen) {
bodylen = contentlen;
- log_fn(LOG_DEBUG,"bodylen reduced to %d.",bodylen);
+ log_fn(LOG_DEBUG,"bodylen reduced to %d.",(int)bodylen);
}
}
/* all happy. copy into the appropriate places, and return 1 */
if (conn->outbuf_flushlen) {
log_fn(LOG_INFO,"fd %d, type %s, state %d, %d bytes on outbuf.",
conn->s, CONN_TYPE_TO_STRING(conn->type),
- conn->state, conn->outbuf_flushlen);
+ conn->state, (int)conn->outbuf_flushlen);
}
tor_close_socket(conn->s);
conn->s = -1;
break;
}
- snprintf(tmp, sizeof(tmp), "%s %s%s HTTP/1.0\r\nContent-Length: %d\r\nHost: %s\r\n\r\n",
+ snprintf(tmp, sizeof(tmp), "%s %s%s HTTP/1.0\r\nContent-Length: %lu\r\nHost: %s\r\n\r\n",
httpcommand,
proxystring,
url,
- payload_len,
+ (unsigned long)payload_len,
hoststring);
connection_write_to_buf(tmp, strlen(tmp), conn);
if(conn->purpose == DIR_PURPOSE_FETCH_DIR) {
/* fetch/process the directory to learn about new routers. */
- log_fn(LOG_INFO,"Received directory (size %d):\n%s", body_len, body);
+ log_fn(LOG_INFO,"Received directory (size %d):\n%s", (int)body_len, body);
if(status_code == 503 || body_len == 0) {
log_fn(LOG_INFO,"Empty directory. Ignoring.");
tor_free(body); tor_free(headers);
running_routers_t *rrs;
routerlist_t *rl;
/* just update our list of running routers, if this list is new info */
- log_fn(LOG_INFO,"Received running-routers list (size %d):\n%s", body_len, body);
+ log_fn(LOG_INFO,"Received running-routers list (size %d):\n%s", (int)body_len, body);
if(status_code != 200) {
log_fn(LOG_WARN,"Received http status code %d from dirserver. Failing.",
status_code);
if(conn->purpose == DIR_PURPOSE_FETCH_RENDDESC) {
log_fn(LOG_INFO,"Received rendezvous descriptor (size %d, status code %d)",
- body_len, status_code);
+ (int)body_len, status_code);
switch(status_code) {
case 200:
if(rend_cache_store(body, body_len) < 0) {
"Conn (addr %s, fd %d, type %s, state %d) marked, but wants to flush %d bytes. "
"(Marked at %s:%d)",
conn->address, conn->s, CONN_TYPE_TO_STRING(conn->type), conn->state,
- conn->outbuf_flushlen, conn->marked_for_close_file, conn->marked_for_close);
+ (int)conn->outbuf_flushlen, conn->marked_for_close_file, conn->marked_for_close);
if(connection_speaks_cells(conn)) {
if(conn->state == OR_CONN_STATE_OPEN) {
retval = flush_buf_tls(conn->tls, conn->outbuf, &conn->outbuf_flushlen);
connection_fetch_from_buf(payload, length, conn);
- log_fn(LOG_DEBUG,"(%d) Packaging %d bytes (%d waiting).", conn->s, length,
- (int)buf_datalen(conn->inbuf));
+ log_fn(LOG_DEBUG,"(%d) Packaging %d bytes (%d waiting).", conn->s,
+ (int)length, (int)buf_datalen(conn->inbuf));
if(connection_edge_send_command(conn, circ, RELAY_COMMAND_DATA,
payload, length, conn->cpath_layer) < 0)
}
while(conn->deliver_window < STREAMWINDOW_START - STREAMWINDOW_INCREMENT) {
- log_fn(LOG_DEBUG,"Outbuf %d, Queueing stream sendme.", conn->outbuf_flushlen);
+ log_fn(LOG_DEBUG,"Outbuf %d, Queueing stream sendme.", (int)conn->outbuf_flushlen);
conn->deliver_window += STREAMWINDOW_INCREMENT;
if(connection_edge_send_command(conn, circ, RELAY_COMMAND_SENDME,
NULL, 0, conn->cpath_layer) < 0) {
}
if (request_len != DH_KEY_LEN+DIGEST_LEN) {
- log_fn(LOG_WARN,"Incorrect length (%d) on RENDEZVOUS2 cell.",request_len);
+ log_fn(LOG_WARN,"Incorrect length (%d) on RENDEZVOUS2 cell.",(int)request_len);
goto err;
}
e->desc = tor_malloc(desc_len);
memcpy(e->desc, desc, desc_len);
- log_fn(LOG_INFO,"Successfully stored rend desc '%s', len %d", query, desc_len);
+ log_fn(LOG_INFO,"Successfully stored rend desc '%s', len %d", query, (int)desc_len);
return 0;
}
if (request_len != REND_COOKIE_LEN+DH_KEY_LEN+DIGEST_LEN) {
log_fn(LOG_WARN,
"Rejecting RENDEZVOUS1 cell with bad length (%d) on circuit %d",
- request_len, circ->p_circ_id);
+ (int)request_len, circ->p_circ_id);
goto err;
}
ptr = rp_nickname+nickname_field_len;
len -= nickname_field_len;
if (len != REND_COOKIE_LEN+DH_KEY_LEN) {
- log_fn(LOG_WARN, "Bad length %u for INTRODUCE2 cell.", len);
+ log_fn(LOG_WARN, "Bad length %u for INTRODUCE2 cell.", (int)len);
return -1;
}
r_cookie = ptr;
/* 6b. [authdirserver only] add own key to approved directories. */
crypto_pk_get_digest(get_identity_key(), digest);
if (!router_digest_is_trusted_dir(digest)) {
- uint32_t addr;
- if(resolve_my_address(options.Address, &addr) < 0) {
- log_fn(LOG_WARN,"options.Address didn't resolve into an IP.");
- return -1;
- }
- add_trusted_dir_server(addr, options.DirPort, digest);
+ add_trusted_dir_server(options.Address, options.DirPort, digest);
}
/* 7. [authdirserver only] load old directory, if it's there */
sprintf(keydir,"%s/cached-directory", datadir);