Skip to content

Instantly share code, notes, and snippets.

@caffeineshock
Created October 1, 2012 15:42
Show Gist options
  • Save caffeineshock/3812581 to your computer and use it in GitHub Desktop.
Save caffeineshock/3812581 to your computer and use it in GitHub Desktop.
static void
send_dummy(int fd, short event, void *args) {
(void)fd;
(void)event;
circuit_t *circ = args;
crypt_path_t *cpath_layer = NULL;
if (CIRCUIT_IS_ORIGIN(circ)) {
cpath_layer = TO_ORIGIN_CIRCUIT(circ)->cpath->prev;
}
relay_send_command_from_edge(
0,
circ,
RELAY_COMMAND_DROP,
NULL,
0,
cpath_layer
);
log(LOG_DEBUG, LD_GENERAL, "Sent dummy packet");
}
int
relay_send_command_from_edge(streamid_t stream_id, circuit_t *circ,
uint8_t relay_command, const char *payload,
size_t payload_len, crypt_path_t *cpath_layer) {
[...]
struct timeval timeout;
static struct event *launch_event;
launch_event = tor_evtimer_new(tor_libevent_get_base(), send_dummy, circ);
timeout.tv_sec = 1;
timeout.tv_usec = 0;
if (evtimer_add(launch_event, &timeout)<0) {
log_warn(LD_BUG, "Couldn't add timer");
}
[...]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment