summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7e9a722)
raw | patch | inline | side by side (parent: 7e9a722)
author | octo <octo> | |
Sun, 29 Jan 2006 16:40:25 +0000 (16:40 +0000) | ||
committer | octo <octo> | |
Sun, 29 Jan 2006 16:40:25 +0000 (16:40 +0000) |
- The client only uses one `addrinfo' address, so messages are not send twice.. The default IPv6 multicast address is prefered over the default IPv4 multicast address.
- `network_receive' is now interruptible by signals. It returns without error (and without data).
- Removed the (old) `Server' and `Port' options from `configfile.c' in favor of the (new) `cf_callback_socket'.
- `network_receive' is now interruptible by signals. It returns without error (and without data).
- Removed the (old) `Server' and `Port' options from `configfile.c' in favor of the (new) `cf_callback_socket'.
src/configfile.c | patch | blob | history | |
src/network.c | patch | blob | history |
diff --git a/src/configfile.c b/src/configfile.c
index 2569b4a9b3bb558eaa31f1a5c5de465799a1a1ba..c217724ad94c46b3ed39b946d66908b3293f3ad9 100644 (file)
--- a/src/configfile.c
+++ b/src/configfile.c
*/
static cf_mode_item_t cf_mode_list[] =
{
+ /*
{"Server", NULL, MODE_CLIENT },
{"Port", NULL, MODE_CLIENT | MODE_SERVER },
+ */
{"PIDFile", NULL, MODE_CLIENT | MODE_SERVER | MODE_LOCAL},
{"DataDir", NULL, MODE_CLIENT | MODE_SERVER | MODE_LOCAL},
{"LogFile", NULL, MODE_CLIENT | MODE_SERVER | MODE_LOCAL}
};
-static int cf_mode_num = 5;
+static int cf_mode_num = 3;
static int nesting_depth = 0;
static char *current_module = NULL;
diff --git a/src/network.c b/src/network.c
index b86d5a255b1f9f5897ab20d4c9d660d846a58392..ddc36e772176aa57715471ff652ebb7c5229d82a 100644 (file)
--- a/src/network.c
+++ b/src/network.c
ret = 0;
- if (network_create_socket (NET_DEFAULT_V4_ADDR, NET_DEFAULT_PORT) > 0)
+ if (network_create_socket (NET_DEFAULT_V6_ADDR, NET_DEFAULT_PORT) > 0)
ret++;
- if (network_create_socket (NET_DEFAULT_V6_ADDR, NET_DEFAULT_PORT) > 0)
+ /* Don't use IPv4 and IPv6 in parallel by default.. */
+ if ((operating_mode == MODE_CLIENT) && (ret != 0))
+ return (ret);
+
+ if (network_create_socket (NET_DEFAULT_V4_ADDR, NET_DEFAULT_PORT) > 0)
ret++;
if (ret == 0)
if (socklist_head == NULL)
network_connect_default ();
- while (1)
+ FD_ZERO (&readfds);
+ max_fd = -1;
+ for (se = socklist_head; se != NULL; se = se->next)
{
- FD_ZERO (&readfds);
- max_fd = -1;
- for (se = socklist_head; se != NULL; se = se->next)
- {
- if (se->mode != operating_mode)
- continue;
+ if (se->mode != operating_mode)
+ continue;
- FD_SET (se->fd, &readfds);
- if (se->fd >= max_fd)
- max_fd = se->fd + 1;
- }
+ FD_SET (se->fd, &readfds);
+ if (se->fd >= max_fd)
+ max_fd = se->fd + 1;
+ }
- if (max_fd == -1)
- {
- syslog (LOG_WARNING, "No listen sockets found!");
- return (-1);
- }
+ if (max_fd == -1)
+ {
+ syslog (LOG_WARNING, "No listen sockets found!");
+ return (-1);
+ }
- status = select (max_fd, &readfds, NULL, NULL, NULL);
+ status = select (max_fd, &readfds, NULL, NULL, NULL);
- if ((status == -1) && (errno == EINTR))
- continue;
- else if (status == -1)
- {
+ if (status == -1)
+ {
+ if (errno != EINTR)
syslog (LOG_ERR, "select: %s", strerror (errno));
- return (-1);
- }
- else
- break;
- } /* while (true) */
+ return (-1);
+ }
fd = -1;
for (se = socklist_head; se != NULL; se = se->next)
else
{
syslog (LOG_ERR, "sendto: %s", strerror (errno));
+ ret = -1;
break;
}
}