// L2TPNS Clustering Stuff
-char const *cvs_id_cluster = "$Id: cluster.c,v 1.20 2004-12-03 06:40:02 bodea Exp $";
+char const *cvs_id_cluster = "$Id: cluster.c,v 1.22 2004-12-13 05:09:55 bodea Exp $";
#include <stdio.h>
#include <sys/file.h>
struct sockaddr_in interface_addr;
struct ip_mreq mreq;
struct ifreq ifr;
- int opt = 0;
+ int opt;
config->cluster_undefined_sessions = MAXSESSION-1;
config->cluster_undefined_tunnels = MAXTUNNEL-1;
addr.sin_addr.s_addr = INADDR_ANY;
setsockopt(cluster_sockfd, SOL_SOCKET, SO_REUSEADDR, &addr, sizeof(addr));
+ opt = fcntl(cluster_sockfd, F_GETFL, 0);
+ fcntl(cluster_sockfd, F_SETFL, opt | O_NONBLOCK);
+
if (bind(cluster_sockfd, (void *) &addr, sizeof(addr)) < 0)
{
LOG(0, 0, 0, "Failed to bind cluster socket: %s\n", strerror(errno));
return -1;
}
- if (setsockopt (cluster_sockfd, IPPROTO_IP, IP_MULTICAST_IF, &interface_addr, sizeof(interface_addr)) < 0)
+ if (setsockopt(cluster_sockfd, IPPROTO_IP, IP_MULTICAST_IF, &interface_addr, sizeof(interface_addr)) < 0)
{
LOG(0, 0, 0, "Failed to setsockopt (set mcast interface): %s\n", strerror(errno));
return -1;
diff += HB_MAX_SEQ;
if (diff >= HB_HISTORY_SIZE) { // Ouch. We don't have the packet to send it!
- LOG(0, 0, 0, "A slaved asked for message %d when our seq number is %d. Killing it.\n",
+ LOG(0, 0, 0, "A slave asked for message %d when our seq number is %d. Killing it.\n",
seq, config->cluster_seq_number);
return peer_send_message(slave, C_KILL, seq, NULL, 0);// Kill the slave. Nothing else to do.
}