This repository has been archived by the owner on Dec 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
Enabling tcp
SaeHie Park edited this page Sep 25, 2015
·
4 revisions
TCP structure uv_tcp_t inherits uv_stream_t
struct uv_tcp_s {
UV_HANDLE_FIELDS
UV_STREAM_FIELDS
UV_TCP_PRIVATE_FIELDS
};
- uv_tcp_init()
- calls uv__stream_init()
- uv__stream_init()
- calls uv__handle_init()
- initialises structure members
- calls uv__io_init() with stream->io_watcher and callback
uv__stream_io()
-
uv__io_init()
-
uv_tcp_open()
- calls uv__stream_open()
- uv__stream_open()
- sets stream->io_watcher.fd to socket
- uv_tcp_connect()
- calls uv__tcp_connect()
- uv__tcp_connect()
- calls uv__socket() to get socket
- calls uv__stream_open() with socket
- calls connect() with stream.fd which is socket
- calls uv__req_init() with
uv_connect_t
type connection requestreq
- sets connection callback to
req
- calls uv__io_start() with UV__POLLOUT
- uv__io_start()
- adds watcher to loop->watcher_queue
- uv_run()
- in uv__stream_io(), calls uv__stream_connect() if stream->connect_req exist
- in uv__stream_connect(),
req
callback is called
-
uv_tcp_init()
-
uv_tcp_bind()
-
uv_listen()
- calls uv_tcp_listen()
- uv_tcp_listen()
- calls maybe_new_socket()
- calls listen()
- calls uv__io_start with uv__server_io
- adds to loop watchers
- uv__handle_start()
- uv__server_io()
- calls uv__io_start() with UV__POLLIN