summaryrefslogtreecommitdiff
path: root/server-proxy.c
diff options
context:
space:
mode:
Diffstat (limited to 'server-proxy.c')
-rw-r--r--server-proxy.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/server-proxy.c b/server-proxy.c
index f897aa2..4cbbb87 100644
--- a/server-proxy.c
+++ b/server-proxy.c
@@ -402,9 +402,15 @@ proxy_new(struct server *server, struct saddr *client, int fd)
list_add(&proxy->list, &server->proxys);
if (server->state != SERVER_STATE_RUNNING) {
- server_start(server);
- ptask_init(&proxy->ptask, 3, 20, proxy_connect_timer_cb);
- ptimer_add_task(&proxy->ptask);
+ if (server_start(server) &&
+ cfg->proxy_connection_interval > 0 &&
+ cfg->proxy_connection_attempts > 0) {
+ ptask_init(&proxy->ptask,
+ cfg->proxy_connection_interval,
+ cfg->proxy_connection_attempts,
+ proxy_connect_timer_cb);
+ ptimer_add_task(&proxy->ptask);
+ }
}
proxy->connecting = true;
@@ -481,15 +487,21 @@ local_open(struct server_local *local)
}
/* The MC protocol expects the client to send data first */
- /* FIXME: could make this configurable */
- option = true;
- if (setsockopt(sfd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &option, sizeof(option)) < 0)
- error("setsockopt: %m");
+ if (cfg->socket_defer) {
+ option = true;
+ if (setsockopt(sfd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &option, sizeof(option)) < 0)
+ error("setsockopt: %m");
+ }
- /* FIXME: could make this configurable */
- option = true;
- if (setsockopt(sfd, IPPROTO_IP, IP_FREEBIND, &option, sizeof(option)) < 0)
- error("setsockopt: %m");
+ /*
+ * This has the advantage that interfaces don't need to be up but
+ * it means that cfg errors will not be caught.
+ */
+ if (cfg->socket_freebind) {
+ option = true;
+ if (setsockopt(sfd, IPPROTO_IP, IP_FREEBIND, &option, sizeof(option)) < 0)
+ error("setsockopt: %m");
+ }
socket_set_low_latency(sfd);