aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/tcp.c b/tcp.c
index 8cf4459..fc1a261 100644
--- a/tcp.c
+++ b/tcp.c
@@ -2884,25 +2884,32 @@ static int tcp_port_rebind_outbound(void *arg)
}
/**
- * tcp_timer() - Periodic tasks: port detection, closed connections, pool refill
+ * tcp_scan_ports() - Update forwarding maps based on scan of listening ports
* @c: Execution context
- * @now: Current timestamp
*/
-void tcp_timer(struct ctx *c, const struct timespec *now)
+void tcp_scan_ports(struct ctx *c)
{
- (void)now;
+ ASSERT(c->mode == MODE_PASTA && !c->no_tcp);
- if (c->mode == MODE_PASTA) {
- if (c->tcp.fwd_out.mode == FWD_AUTO) {
- fwd_scan_ports_tcp(&c->tcp.fwd_out, &c->tcp.fwd_in);
- NS_CALL(tcp_port_rebind_outbound, c);
- }
+ if (c->tcp.fwd_out.mode == FWD_AUTO) {
+ fwd_scan_ports_tcp(&c->tcp.fwd_out, &c->tcp.fwd_in);
+ NS_CALL(tcp_port_rebind_outbound, c);
+ }
- if (c->tcp.fwd_in.mode == FWD_AUTO) {
- fwd_scan_ports_tcp(&c->tcp.fwd_in, &c->tcp.fwd_out);
- tcp_port_rebind(c, false);
- }
+ if (c->tcp.fwd_in.mode == FWD_AUTO) {
+ fwd_scan_ports_tcp(&c->tcp.fwd_in, &c->tcp.fwd_out);
+ tcp_port_rebind(c, false);
}
+}
+
+/**
+ * tcp_timer() - Periodic tasks: port detection, closed connections, pool refill
+ * @c: Execution context
+ * @now: Current timestamp
+ */
+void tcp_timer(const struct ctx *c, const struct timespec *now)
+{
+ (void)now;
tcp_sock_refill_init(c);
if (c->mode == MODE_PASTA)