TCP option assign hook doesn't work well if option not supported

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема TCP option assign hook doesn't work well if option not supported
Дата
Msg-id 4681a78a-cc8e-76c0-75ac-7aef6def1908@2ndquadrant.com
обсуждение исходный текст
Ответы Re: TCP option assign hook doesn't work well if option not supported  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
macOS does not support the socket option TCP_USER_TIMEOUT.  Yet, I can 
start a server with postgres -D ... --tcp-user-timeout=100 without a 
diagnostic.  Only when I connect I get a log entry

LOG:  setsockopt(TCP_USER_TIMEOUT) not supported

Perhaps the logic in pq_settcpusertimeout() should be changed like this:

  int
  pq_settcpusertimeout(int timeout, Port *port)
  {
+#ifdef TCP_USER_TIMEOUT
     if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
         return STATUS_OK;

-#ifdef TCP_USER_TIMEOUT
     if (timeout == port->tcp_user_timeout)
         return STATUS_OK;

So that the #else branch that is supposed to check this will also be run 
in the postmaster (where port == NULL).

Or perhaps there should be a separate GUC check hook that just does

#ifndef TCP_USER_TIMEOUT
     if (val != 0)
         return false;
#endif
     return true;

The same considerations apply to the various TCP keepalive settings, but 
since those are widely supported the unsupported code paths probably 
haven't gotten much attention.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: How is this possible "publication does not exist"
Следующее
От: Juan José Santamaría Flecha
Дата:
Сообщение: Re: Clean up some old cruft related to Windows