socket.c在4000行位置定义了一组结构函数,我们可以从这里开始找到入口,如果是客户端则需要调用connect,
如果是服务端则需要调用listen,
struct rpc_transport_ops tops =
{
.listen = socket_listen,
.connect = socket_connect,
.disconnect = socket_disconnect,
.submit_request = socket_submit_request,
.submit_reply = socket_submit_reply,
.get_peername = socket_getpeername,
.get_peeraddr = socket_getpeeraddr,
.get_myname = socket_getmyname,
.get_myaddr = socket_getmyaddr,
.throttle = socket_throttle,
};
在connect函数的第3541行处,将socket加入到eventpool的监控范围,
priv->idx = event_register (ctx->event_pool, priv->sock,
socket_event_handler,
this, 1, 1);