socket_dispatch_timer, s);
}
-static int socket_instantiate_service(Socket *s) {
- _cleanup_free_ char *prefix = NULL;
- _cleanup_free_ char *name = NULL;
+int socket_instantiate_service(Socket *s) {
+ _cleanup_free_ char *prefix = NULL, *name = NULL;
int r;
Unit *u;
* here. For Accept=no this is mostly a NOP since the service
* is figured out at load time anyway. */
- if (UNIT_DEREF(s->service))
+ if (UNIT_DEREF(s->service) || !s->accept)
return 0;
- assert(s->accept);
-
prefix = unit_name_to_prefix(UNIT(s)->id);
if (!prefix)
return -ENOMEM;
"%sSocketMode: %04o\n"
"%sDirectoryMode: %04o\n"
"%sKeepAlive: %s\n"
+ "%sNoDelay: %s\n"
+ "%sFastOpen: %s\n"
"%sFreeBind: %s\n"
"%sTransparent: %s\n"
"%sBroadcast: %s\n"
prefix, s->socket_mode,
prefix, s->directory_mode,
prefix, yes_no(s->keep_alive),
+ prefix, yes_no(s->no_delay),
+ prefix, yes_no(s->fast_open),
prefix, yes_no(s->free_bind),
prefix, yes_no(s->transparent),
prefix, yes_no(s->broadcast),
log_warning_unit(UNIT(s)->id, "SO_KEEPALIVE failed: %m");
}
+ if (s->no_delay) {
+ int b = s->no_delay;
+ if (setsockopt(fd, SOL_TCP, TCP_NODELAY, &b, sizeof(b)) < 0)
+ log_warning_unit(UNIT(s)->id, "TCP_NODELAY failed: %m");
+ }
+
+ if (s->fast_open) {
+ int b = s->fast_open;
+ if (setsockopt(fd, SOL_TCP, TCP_FASTOPEN, &b, sizeof(b)) < 0)
+ log_warning_unit(UNIT(s)->id, "TCP_FASTOPEN failed: %m");
+ }
+
if (s->broadcast) {
int one = 1;
if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one)) < 0)