s/oio_tcp_handle_init/oio_tcp_init/
This commit is contained in:
parent
8f6a175e9d
commit
61e1f5f3c9
@ -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) {
|
||||
handle->type = OIO_TCP;
|
||||
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->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->write_watcher.data == handle);
|
||||
assert(handle->read_watcher.data == handle);
|
||||
@ -263,7 +263,7 @@ int oio_accept(oio_handle* server, oio_handle* client,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (oio_tcp_handle_init(client, close_cb, data)) {
|
||||
if (oio_tcp_init(client, close_cb, data)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -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) {
|
||||
handle->close_cb = close_cb;
|
||||
handle->data = data;
|
||||
|
||||
2
oio.h
2
oio.h
@ -121,7 +121,7 @@ void oio_req_init(oio_req* req, oio_handle* handle, void* cb);
|
||||
|
||||
/* TCP socket methods. */
|
||||
/* 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_connect(oio_req* req, struct sockaddr* addr);
|
||||
int oio_shutdown(oio_req* req);
|
||||
|
||||
@ -105,7 +105,7 @@ int echo_start(int port) {
|
||||
struct sockaddr_in addr = oio_ip4_addr("0.0.0.0", port);
|
||||
int r;
|
||||
|
||||
r = oio_tcp_handle_init(&server, on_server_close, NULL);
|
||||
r = oio_tcp_init(&server, on_server_close, NULL);
|
||||
if (r) {
|
||||
/* TODO: Error codes */
|
||||
fprintf(stderr, "Socket creation error\n");
|
||||
|
||||
@ -42,8 +42,8 @@ TEST_IMPL(close_cb_stack) {
|
||||
|
||||
oio_init();
|
||||
|
||||
if (oio_tcp_handle_init(&handle, &close_cb, NULL)) {
|
||||
FATAL("oio_tcp_handle_init failed");
|
||||
if (oio_tcp_init(&handle, &close_cb, NULL)) {
|
||||
FATAL("oio_tcp_init failed");
|
||||
}
|
||||
|
||||
nested++;
|
||||
|
||||
@ -139,7 +139,7 @@ void pinger_new() {
|
||||
pinger->buf.base = (char*)&pinger->read_buffer;
|
||||
|
||||
/* 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);
|
||||
|
||||
/* We are never doing multiple reads/connects at a time anyway. */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user