This is used in the test, in order to stop accepting new connections after
the first one.
void do_accept(struct utcp_connection *nc, uint16_t port) {
utcp_accept(nc, do_recv, NULL);
c = nc;
+ utcp_set_accept_cb(c->utcp, NULL, NULL);
}
ssize_t do_send(struct utcp *utcp, const void *data, size_t len) {
if(c)
c->poll = poll;
}
+
+void utcp_set_accept_cb(struct utcp *utcp, utcp_accept_t accept, utcp_pre_accept_t pre_accept) {
+ if(utcp) {
+ utcp->accept = accept;
+ utcp->pre_accept = pre_accept;
+ }
+}
extern struct timeval utcp_timeout(struct utcp *utcp);
extern void utcp_set_recv_cb(struct utcp_connection *connection, utcp_recv_t recv);
extern void utcp_set_poll_cb(struct utcp_connection *connection, utcp_poll_t poll);
+extern void utcp_set_accept_cb(struct utcp *utcp, utcp_accept_t accept, utcp_pre_accept_t pre_accept);
// Global socket options