Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

bring back uv_init

  • Loading branch information...
piscisaureus committed Aug 31, 2011
1 parent 56dcaf9 commit 3aec77f9d448ad4f5a13ee8d32515eab93fb741b
@@ -81,6 +81,7 @@ typedef struct uv_work_s uv_work_t;
* All callbacks in libuv are made asynchronously. That is they are never
* made by the function that takes them as a parameter.
*/
void uv_init();
uv_loop_t* uv_loop_new();

void uv_loop_delete(uv_loop_t*);
@@ -84,7 +84,7 @@ BENCHMARK_IMPL(gethostbyname) {
return 1;
}


uv_init();
ares_callbacks = 0;
ares_errors = 0;

@@ -66,7 +66,7 @@ static void getaddrinfo_initiate(uv_getaddrinfo_t* handle) {
BENCHMARK_IMPL(getaddrinfo) {
int i;


uv_init();

uv_update_time();
start_time = uv_now();
@@ -198,7 +198,7 @@ static void pinger_new() {


BENCHMARK_IMPL(ping_pongs) {

uv_init();
start_time = uv_now();

pinger_new();
@@ -275,7 +275,7 @@ static int pound_it(int concurrency,
uint64_t start_time; /* in ns */
uint64_t end_time;


uv_init();

uv_update_time();
start = uv_now();
@@ -366,7 +366,7 @@ HELPER_IMPL(tcp_pump_server) {
int r;

type = TCP;

uv_init();
listen_addr = uv_ip4_addr("0.0.0.0", TEST_PORT);

/* Server */
@@ -388,7 +388,7 @@ HELPER_IMPL(pipe_pump_server) {
int r;
type = PIPE;


uv_init();

/* Server */
server = (uv_stream_t*)&pipeServer;
@@ -410,7 +410,7 @@ void tcp_pump(int n) {
TARGET_CONNECTIONS = n;
type = TCP;


uv_init();

connect_addr = uv_ip4_addr("127.0.0.1", TEST_PORT);

@@ -426,7 +426,7 @@ void pipe_pump(int n) {
TARGET_CONNECTIONS = n;
type = PIPE;


uv_init();

/* Start making connections */
maybe_connect_some();
@@ -130,7 +130,7 @@ BENCHMARK_IMPL(spawn) {
int r;
static int64_t start_time, end_time;


uv_init();

r = uv_exepath(exepath, &exepath_size);
ASSERT(r == 0);
@@ -314,7 +314,7 @@ static int dns_start(int port) {


HELPER_IMPL(dns_server) {

uv_init();
if (dns_start(TEST_PORT_2))
return 1;

@@ -270,6 +270,7 @@ static int pipe_echo_start(char* pipeName) {


HELPER_IMPL(tcp4_echo_server) {
uv_init();
uv_loop_t* loop = uv_default_loop();

if (tcp4_echo_start(TEST_PORT))
@@ -281,6 +282,7 @@ HELPER_IMPL(tcp4_echo_server) {


HELPER_IMPL(tcp6_echo_server) {
uv_init();
uv_loop_t* loop = uv_default_loop();

if (tcp6_echo_start(TEST_PORT))
@@ -292,6 +294,7 @@ HELPER_IMPL(tcp6_echo_server) {


HELPER_IMPL(pipe_echo_server) {
uv_init();
uv_loop_t* loop = uv_default_loop();

if (pipe_echo_start(TEST_PIPENAME))
@@ -182,6 +182,8 @@ static void prepare_cb(uv_prepare_t* handle, int status) {
TEST_IMPL(async) {
int r;

uv_init();

r = uv_prepare_init(uv_default_loop(), &prepare_handle);
ASSERT(r == 0);
r = uv_prepare_start(&prepare_handle, prepare_cb);
@@ -176,6 +176,8 @@ static void connect_cb(uv_connect_t* req, int status) {
TEST_IMPL(callback_stack) {
struct sockaddr_in addr = uv_ip4_addr("127.0.0.1", TEST_PORT);

uv_init();

if (uv_tcp_init(uv_default_loop(), &client)) {
FATAL("uv_tcp_init failed");
}
@@ -119,7 +119,7 @@ void connection_fail(uv_connect_cb connect_cb) {
* expect an error.
*/
TEST_IMPL(connection_fail) {

uv_init();

connection_fail(on_connect_with_close);

@@ -136,6 +136,7 @@ TEST_IMPL(connection_fail) {
* attempt.
*/
TEST_IMPL(connection_fail_doesnt_auto_close) {
uv_init();


uv_timer_init(uv_default_loop(), &timer);
@@ -180,7 +180,7 @@ static void client_connect() {


TEST_IMPL(delayed_accept) {

uv_init();

start_server();

@@ -67,6 +67,7 @@ static void getaddrinfo_cuncurrent_cb(uv_getaddrinfo_t* handle,
TEST_IMPL(getaddrinfo_basic) {
int r;

uv_init();


r = uv_getaddrinfo(uv_default_loop(),
@@ -88,7 +89,7 @@ TEST_IMPL(getaddrinfo_basic) {
TEST_IMPL(getaddrinfo_concurrent) {
int i, r;


uv_init();

for (i = 0; i < CONCURRENT_COUNT; i++) {
callback_counts[i] = 0;
@@ -91,7 +91,7 @@ TEST_IMPL(gethostbyname) {
return 1;
}


uv_init();

printf("Start basic gethostbyname test\n");
prep_tcploopback();
@@ -288,7 +288,7 @@ static void udp_sender(void) {


TEST_IMPL(getsockname_tcp) {

uv_init();

if (tcp_listener(TEST_PORT))
return 1;
@@ -316,4 +316,4 @@ TEST_IMPL(getsockname_udp) {
ASSERT(getsocknamecount == 2);

return 0;
}
}
@@ -60,6 +60,7 @@ static void idle_cb(uv_idle_t* handle, int status) {
TEST_IMPL(idle_starvation) {
int r;

uv_init();


r = uv_idle_init(uv_default_loop(), &idle_handle);
@@ -299,6 +299,7 @@ TEST_IMPL(loop_handles) {
int i;
int r;

uv_init();


r = uv_prepare_init(uv_default_loop(), &prepare_1_handle);
@@ -221,7 +221,7 @@ static void pipe_pinger_new() {


TEST_IMPL(tcp_ping_pong) {

uv_init();

tcp_pinger_new();
uv_run(uv_default_loop());
@@ -233,7 +233,7 @@ TEST_IMPL(tcp_ping_pong) {


TEST_IMPL(tcp_ping_pong_v6) {

uv_init();

tcp_pinger_v6_new();
uv_run(uv_default_loop());
@@ -245,7 +245,7 @@ TEST_IMPL(tcp_ping_pong_v6) {


TEST_IMPL(pipe_ping_pong) {

uv_init();

pipe_pinger_new();
uv_run(uv_default_loop());
@@ -45,6 +45,7 @@ TEST_IMPL(pipe_bind_error_addrinuse) {
uv_pipe_t server1, server2;
int r;

uv_init();


r = uv_pipe_init(uv_default_loop(), &server1);
@@ -81,6 +82,7 @@ TEST_IMPL(pipe_bind_error_addrnotavail) {
uv_pipe_t server;
int r;

uv_init();


r = uv_pipe_init(uv_default_loop(), &server);
@@ -104,6 +106,7 @@ TEST_IMPL(pipe_bind_error_inval) {
uv_pipe_t server;
int r;

uv_init();


r = uv_pipe_init(uv_default_loop(), &server);
@@ -129,6 +132,7 @@ TEST_IMPL(pipe_listen_without_bind) {
uv_pipe_t server;
int r;

uv_init();


r = uv_pipe_init(uv_default_loop(), &server);
@@ -24,13 +24,15 @@


TEST_IMPL(ref) {
uv_init();
uv_run(uv_default_loop());
return 0;
}


TEST_IMPL(idle_ref) {
uv_idle_t h;
uv_init();
uv_idle_init(uv_default_loop(), &h);
uv_idle_start(&h, NULL);
uv_unref(uv_default_loop());
@@ -41,6 +43,7 @@ TEST_IMPL(idle_ref) {

TEST_IMPL(async_ref) {
uv_async_t h;
uv_init();
uv_async_init(uv_default_loop(), &h, NULL);
uv_unref(uv_default_loop());
uv_run(uv_default_loop());
@@ -50,6 +53,7 @@ TEST_IMPL(async_ref) {

TEST_IMPL(prepare_ref) {
uv_prepare_t h;
uv_init();
uv_prepare_init(uv_default_loop(), &h);
uv_prepare_start(&h, NULL);
uv_unref(uv_default_loop());
@@ -60,6 +64,7 @@ TEST_IMPL(prepare_ref) {

TEST_IMPL(check_ref) {
uv_check_t h;
uv_init();
uv_check_init(uv_default_loop(), &h);
uv_check_start(&h, NULL);
uv_unref(uv_default_loop());
@@ -78,6 +83,7 @@ static void prepare_cb(uv_prepare_t* handle, int status) {

TEST_IMPL(unref_in_prepare_cb) {
uv_prepare_t h;
uv_init();

uv_prepare_init(uv_default_loop(), &h);
uv_prepare_start(&h, prepare_cb);
@@ -153,7 +153,7 @@ TEST_IMPL(shutdown_eof) {
struct sockaddr_in server_addr;
int r;


uv_init();

qbuf.base = "Q";
qbuf.len = 1;
@@ -116,7 +116,7 @@ static void timer_cb(uv_timer_t* handle, int status) {
TEST_IMPL(spawn_exit_code) {
int r;


uv_init();

init_process_options("spawn_helper1", exit_cb);

@@ -137,7 +137,7 @@ TEST_IMPL(spawn_stdout) {
int r;
uv_pipe_t out;


uv_init();

init_process_options("spawn_helper2", exit_cb);

@@ -170,7 +170,7 @@ int r;
uv_buf_t buf;
char buffer[] = "hello-from-spawn_stdin";


uv_init();

init_process_options("spawn_helper3", exit_cb);

@@ -204,7 +204,7 @@ int r;
TEST_IMPL(spawn_and_kill) {
int r;


uv_init();

init_process_options("spawn_helper4", kill_cb);

@@ -234,7 +234,7 @@ TEST_IMPL(spawn_detect_pipe_name_collisions_on_windows) {
char name[64];
HANDLE pipe_handle;


uv_init();

init_process_options("spawn_helper2", exit_cb);

0 comments on commit 3aec77f

Please sign in to comment.
You can’t perform that action at this time.