s/oio_tcp_handle_init/oio_tcp_init/

This commit is contained in:
Ryan Dahl 2011-04-18 13:01:50 -07:00
parent 8f6a175e9d
commit 61e1f5f3c9
6 changed files with 9 additions and 9 deletions

View File

@ -121,7 +121,7 @@ int oio_run() {
} }
int oio_tcp_handle_init(oio_handle *handle, oio_close_cb close_cb, int oio_tcp_init(oio_handle *handle, oio_close_cb close_cb,
void* data) { void* data) {
handle->type = OIO_TCP; handle->type = OIO_TCP;
handle->close_cb = close_cb; handle->close_cb = close_cb;
@ -203,7 +203,7 @@ int oio_tcp_open(oio_handle* handle, int fd) {
ev_io_set(&handle->read_watcher, fd, EV_READ); ev_io_set(&handle->read_watcher, fd, EV_READ);
ev_io_set(&handle->write_watcher, fd, EV_WRITE); ev_io_set(&handle->write_watcher, fd, EV_WRITE);
/* These should have been set up by oio_tcp_handle_init. */ /* These should have been set up by oio_tcp_init. */
assert(handle->next_watcher.data == handle); assert(handle->next_watcher.data == handle);
assert(handle->write_watcher.data == handle); assert(handle->write_watcher.data == handle);
assert(handle->read_watcher.data == handle); assert(handle->read_watcher.data == handle);
@ -263,7 +263,7 @@ int oio_accept(oio_handle* server, oio_handle* client,
return -1; return -1;
} }
if (oio_tcp_handle_init(client, close_cb, data)) { if (oio_tcp_init(client, close_cb, data)) {
return -1; return -1;
} }

View File

@ -343,7 +343,7 @@ static int oio_set_socket_options(SOCKET socket) {
} }
int oio_tcp_handle_init(oio_handle *handle, oio_close_cb close_cb, int oio_tcp_init(oio_handle *handle, oio_close_cb close_cb,
void* data) { void* data) {
handle->close_cb = close_cb; handle->close_cb = close_cb;
handle->data = data; handle->data = data;

2
oio.h
View File

@ -121,7 +121,7 @@ void oio_req_init(oio_req* req, oio_handle* handle, void* cb);
/* TCP socket methods. */ /* TCP socket methods. */
/* Handle and callback bust be set by calling oio_req_init. */ /* Handle and callback bust be set by calling oio_req_init. */
int oio_tcp_handle_init(oio_handle *handle, oio_close_cb close_cb, void* data); int oio_tcp_init(oio_handle *handle, oio_close_cb close_cb, void* data);
int oio_bind(oio_handle* handle, struct sockaddr* addr); int oio_bind(oio_handle* handle, struct sockaddr* addr);
int oio_connect(oio_req* req, struct sockaddr* addr); int oio_connect(oio_req* req, struct sockaddr* addr);
int oio_shutdown(oio_req* req); int oio_shutdown(oio_req* req);

View File

@ -105,7 +105,7 @@ int echo_start(int port) {
struct sockaddr_in addr = oio_ip4_addr("0.0.0.0", port); struct sockaddr_in addr = oio_ip4_addr("0.0.0.0", port);
int r; int r;
r = oio_tcp_handle_init(&server, on_server_close, NULL); r = oio_tcp_init(&server, on_server_close, NULL);
if (r) { if (r) {
/* TODO: Error codes */ /* TODO: Error codes */
fprintf(stderr, "Socket creation error\n"); fprintf(stderr, "Socket creation error\n");

View File

@ -42,8 +42,8 @@ TEST_IMPL(close_cb_stack) {
oio_init(); oio_init();
if (oio_tcp_handle_init(&handle, &close_cb, NULL)) { if (oio_tcp_init(&handle, &close_cb, NULL)) {
FATAL("oio_tcp_handle_init failed"); FATAL("oio_tcp_init failed");
} }
nested++; nested++;

View File

@ -139,7 +139,7 @@ void pinger_new() {
pinger->buf.base = (char*)&pinger->read_buffer; pinger->buf.base = (char*)&pinger->read_buffer;
/* Try to connec to the server and do NUM_PINGS ping-pongs. */ /* Try to connec to the server and do NUM_PINGS ping-pongs. */
r = oio_tcp_handle_init(&pinger->handle, pinger_on_close, (void*)pinger); r = oio_tcp_init(&pinger->handle, pinger_on_close, (void*)pinger);
ASSERT(!r); ASSERT(!r);
/* We are never doing multiple reads/connects at a time anyway. */ /* We are never doing multiple reads/connects at a time anyway. */