REORG/MEDIUM: move protocol->{read,write} to sock_ops
The protocol must not set the read and write callbacks, they're specific
to the socket layer. Move them to sock_ops instead.
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 1f0d6dc..f709e73 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -70,8 +70,6 @@
.sock_addrlen = sizeof(struct sockaddr_in),
.l3_addrlen = 32/8,
.accept = &stream_sock_accept,
- .read = &stream_sock_read,
- .write = &stream_sock_write,
.bind = tcp_bind_listener,
.bind_all = tcp_bind_listeners,
.unbind_all = unbind_all_listeners,
@@ -90,8 +88,6 @@
.sock_addrlen = sizeof(struct sockaddr_in6),
.l3_addrlen = 128/8,
.accept = &stream_sock_accept,
- .read = &stream_sock_read,
- .write = &stream_sock_write,
.bind = tcp_bind_listener,
.bind_all = tcp_bind_listeners,
.unbind_all = unbind_all_listeners,
@@ -446,9 +442,9 @@
fdtab[fd].owner = si;
fdtab[fd].state = FD_STCONN; /* connection in progress */
fdtab[fd].flags = FD_FL_TCP | FD_FL_TCP_NODELAY;
- fdtab[fd].cb[DIR_RD].f = &stream_sock_read;
+ fdtab[fd].cb[DIR_RD].f = si->sock.read;
fdtab[fd].cb[DIR_RD].b = si->ib;
- fdtab[fd].cb[DIR_WR].f = &stream_sock_write;
+ fdtab[fd].cb[DIR_WR].f = si->sock.write;
fdtab[fd].cb[DIR_WR].b = si->ob;
fdinfo[fd].peeraddr = (struct sockaddr *)&si->addr.to;