MINOR: protocol: add a set of ctrl_init/ctrl_close methods for setup/teardown

Currnetly conn_ctrl_init() does an fd_insert() and conn_ctrl_close() does an
fd_delete(). These are the two only short-term obstacles against using a
non-fd handle to set up a connection. Let's have pur these into the protocol
layer, along with the other connection-level stuff so that the generic
connection code uses them instead. This will allow to define new ones for
other protocols (e.g. QUIC).

Since we only support regular sockets at the moment, the code was placed
into sock.c and shared with proto_tcp, proto_uxst and proto_sockpair.
diff --git a/src/sock.c b/src/sock.c
index 9eff7f1..c7a5f80 100644
--- a/src/sock.c
+++ b/src/sock.c
@@ -625,6 +625,25 @@
 	listener_accept(l);
 }
 
+/* This completes the initialization of connection <conn> by inserting its FD
+ * into the fdtab, associating it with the regular connection handler. It will
+ * be bound to the current thread only. This call cannot fail.
+ */
+void sock_conn_ctrl_init(struct connection *conn)
+{
+	fd_insert(conn->handle.fd, conn, conn_fd_handler, tid_bit);
+}
+
+/* This completes the release of connection <conn> by removing its FD from the
+ * fdtab and deleting it. The connection must not use the FD anymore past this
+ * point. The FD may be modified in the connection.
+ */
+void sock_conn_ctrl_close(struct connection *conn)
+{
+	fd_delete(conn->handle.fd);
+	conn->handle.fd = DEAD_FD_MAGIC;
+}
+
 /*
  * Local variables:
  *  c-indent-level: 8