Commit Graph

16 Commits

Author SHA1 Message Date
Jan Friesse
df3c6722b3 qnetd: Don't alloc host_addr
getopt will return pointer to argv so there is no need to dup optarg.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-11-23 14:18:41 +01:00
Jan Friesse
a8b7513df9 qnetd: Improve dead peer detection
Previously dead peer detection timer was scheduled every dpd_interval,
added dpd_interval to all of the clients timestamp and if timestamp was
larger than client hearbeat interval * 1.2 then check if client sent
some message. If so, flag was reset.

This method was source of number of problems so instead different method
is now used.

Every single client has its own timer with timeout based on
(configurable) dpd_interval_coefficient and multiplied with
client heartbeat timeout. When message is received from client timer is
rescheduled. When timer callback is called (= client doesn't sent
message during timeout) then client is disconnected.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-11-18 15:05:21 +01:00
Jan Friesse
3bbf28b368 qnetd: Return error code based on ipc closed
So restore pre pr-poll-loop behavior.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-31 17:04:49 +02:00
Jan Friesse
01a63aae28 pr-poll-loop: Pass PRPollDesc for prfd events
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-28 08:57:15 +02:00
Jan Friesse
1ad070d8a9 qnetd: Move pr_poll_loop_exec call to function
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-28 08:57:15 +02:00
Jan Friesse
8144b162f0 qnetd: Remove write callback on listening sockets
IPC and TLS sockets are read only, so write callbacks should never
happen (specifically tested in pr-poll-loop test) so remove them.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-25 18:01:18 +02:00
Jan Friesse
c1910888ed pr-poll-loop: Return error code if PR_Poll fails
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-25 18:01:17 +02:00
Jan Friesse
406b689d36 qdevice: Use EXIT_SUCCESS and EXIT_FAILURE codes
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-12 15:52:17 +02:00
Jan Friesse
6f55a0649f qnetd: Migrate main loop to pr-poll-loop
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-12 15:52:17 +02:00
Jan Friesse
c8d19612c2 qdevice: Use log instead of libqb log
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-12 17:47:39 +02:00
Jan Friesse
6cc1388e06 qnetd: Add function to set log target
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-12 17:47:39 +02:00
Jan Friesse
5128d3182d qnetd: Check log initialization error
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-12 17:47:39 +02:00
Jan Friesse
bb9dabf945 qnetd: Rename qnetd-log.c to log.c
And remove qnetd_ prefix from function names.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-12 17:47:39 +02:00
Jan Friesse
31cc21726e qnetd: Check existence of NSS DB dir before fork
Previously, when user tried start corosync-qnetd without
initialized NSS database then generic (not very helpful
and misleading) NSS error was logged
"NSS error (-8015): The certificate/key database is in an old,
unsupported format.".

Solution is to check if it's possible to open NSS DB directory and
display (usually much more informative) result of strerror function.

Such check is called before fork, so init system can return error code
during start.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2019-03-19 15:23:09 +01:00
Jan Friesse
3b21d7584c qnetd: Replace strtol by strtonum
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2018-03-02 13:34:00 +01:00
Jan Friesse
9a1955a7d6 Initial import from corosync codebase
Used the code from corosync master
(31ddba64a2726bcedf81eb84df2e2da4846832f7)

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2018-01-23 14:24:36 +01:00