ol_handle_new -> ol_tcp_handle_new
This commit is contained in:
parent
dee44d886b
commit
3a23aaa21c
@ -54,7 +54,7 @@ int ol_run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ol_handle* ol_handle_new(ol_close_cb close_cb, void* data) {
|
ol_handle* ol_tcp_handle_new(ol_close_cb close_cb, void* data) {
|
||||||
ol_handle *handle = calloc(sizeof(ol_handle), 1);
|
ol_handle *handle = calloc(sizeof(ol_handle), 1);
|
||||||
handle->close_cb = close_cb;
|
handle->close_cb = close_cb;
|
||||||
handle->data = data;
|
handle->data = data;
|
||||||
@ -127,7 +127,7 @@ int ol_tcp_init_fd(int fd) {
|
|||||||
|
|
||||||
|
|
||||||
ol_handle* ol_tcp_open(ol_handle* parent, int fd) {
|
ol_handle* ol_tcp_open(ol_handle* parent, int fd) {
|
||||||
ol_handle* h = ol_handle_new(NULL, NULL);
|
ol_handle* h = ol_tcp_handle_new(NULL, NULL);
|
||||||
if (!h) {
|
if (!h) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
7
ol.h
7
ol.h
@ -80,7 +80,12 @@ const char* ol_err_str(ol_err err);
|
|||||||
void ol_init();
|
void ol_init();
|
||||||
int ol_run();
|
int ol_run();
|
||||||
|
|
||||||
ol_handle* ol_handle_new(ol_close_cb close_cb, void* data);
|
ol_handle* ol_tcp_handle_new(ol_close_cb close_cb, void* data);
|
||||||
|
/* TODO:
|
||||||
|
* ol_named_pipe_handle_new
|
||||||
|
* ol_file_handle_new
|
||||||
|
* ol_tty_handle_new
|
||||||
|
*/
|
||||||
|
|
||||||
/* TCP server methods. */
|
/* TCP server methods. */
|
||||||
int ol_bind(ol_handle* handle, struct sockaddr* addr);
|
int ol_bind(ol_handle* handle, struct sockaddr* addr);
|
||||||
|
|||||||
@ -89,7 +89,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
ol_init();
|
ol_init();
|
||||||
|
|
||||||
server = ol_handle_new(on_close, NULL);
|
server = ol_tcp_handle_new(on_close, NULL);
|
||||||
|
|
||||||
addr = ol_ip4_addr("0.0.0.0", 8000);
|
addr = ol_ip4_addr("0.0.0.0", 8000);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user