CLEANUP: connection: split sock_ops into data_ops, app_cp and si_ops
Some parts of the sock_ops structure were only used by the stream
interface and have been moved into si_ops. Some of them were callbacks
to the stream interface from the connection and have been moved into
app_cp as they're the application seen from the connection (later,
health-checks will need to use them). The rest has moved to data_ops.
Normally at this point the connection could live without knowing about
stream interfaces at all.
diff --git a/src/backend.c b/src/backend.c
index d5c4a99..b777cc3 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -984,13 +984,11 @@
/* set the correct protocol on the output stream interface */
if (s->target.type == TARG_TYPE_SERVER) {
- s->req->cons->conn.ctrl = target_srv(&s->target)->proto;
- stream_interface_prepare(s->req->cons, target_srv(&s->target)->sock);
+ si_prepare_conn(s->req->cons, target_srv(&s->target)->proto, target_srv(&s->target)->data);
}
else if (s->target.type == TARG_TYPE_PROXY) {
/* proxies exclusively run on raw_sock right now */
- s->req->cons->conn.ctrl = protocol_by_family(s->req->cons->addr.to.ss_family);
- stream_interface_prepare(s->req->cons, &raw_sock);
+ si_prepare_conn(s->req->cons, protocol_by_family(s->req->cons->addr.to.ss_family), &raw_sock);
if (!si_ctrl(s->req->cons))
return SN_ERR_INTERNAL;
}