aboutsummaryrefslogtreecommitdiff
path: root/src/or/cpuworker.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/cpuworker.c')
-rw-r--r--src/or/cpuworker.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 91af5f1d6..c5e4863f7 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -13,6 +13,15 @@
**/
#include "or.h"
+#include "buffers.h"
+#include "circuitbuild.h"
+#include "circuitlist.h"
+#include "config.h"
+#include "connection.h"
+#include "cpuworker.h"
+#include "main.h"
+#include "onion.h"
+#include "router.h"
/** The maximum number of cpuworker processes we will keep around. */
#define MAX_CPUWORKERS 16
@@ -183,7 +192,7 @@ connection_cpu_process_inbuf(connection_t *conn)
tor_assert(0); /* don't ask me to do handshakes yet */
}
-done_processing:
+ done_processing:
conn->state = CPUWORKER_STATE_IDLE;
num_cpuworkers_busy--;
if (conn->timestamp_created < last_rotation_time) {
@@ -217,8 +226,8 @@ cpuworker_main(void *data)
{
char question[ONIONSKIN_CHALLENGE_LEN];
uint8_t question_type;
- int *fdarray = data;
- int fd;
+ tor_socket_t *fdarray = data;
+ tor_socket_t fd;
/* variables for onion processing */
char keys[CPATH_KEY_MATERIAL_LEN];
@@ -241,7 +250,7 @@ cpuworker_main(void *data)
for (;;) {
ssize_t r;
- if ((r = recv(fd, &question_type, 1, 0)) != 1) {
+ if ((r = recv(fd, (void *)&question_type, 1, 0)) != 1) {
// log_fn(LOG_ERR,"read type failed. Exiting.");
if (r == 0) {
log_info(LD_OR,
@@ -308,12 +317,12 @@ cpuworker_main(void *data)
static int
spawn_cpuworker(void)
{
- int *fdarray;
- int fd;
+ tor_socket_t *fdarray;
+ tor_socket_t fd;
connection_t *conn;
int err;
- fdarray = tor_malloc(sizeof(int)*2);
+ fdarray = tor_malloc(sizeof(tor_socket_t)*2);
if ((err = tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fdarray)) < 0) {
log_warn(LD_NET, "Couldn't construct socketpair for cpuworker: %s",
tor_socket_strerror(-err));
@@ -358,7 +367,7 @@ spawn_cpuworker(void)
static void
spawn_enough_cpuworkers(void)
{
- int num_cpuworkers_needed = get_options()->NumCpus;
+ int num_cpuworkers_needed = get_options()->NumCPUs;
if (num_cpuworkers_needed < MIN_CPUWORKERS)
num_cpuworkers_needed = MIN_CPUWORKERS;