1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

set SO_KEEPALIVE on sockets

This commit is contained in:
Patrick Caulfield 2005-04-01 16:03:00 +00:00
parent 11270d07bf
commit a478de3db6
2 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,7 @@
Version 2.01.09 - Version 2.01.09 -
================================= =================================
clvmd: Don't allow user operations to start until the lvm thread is fully up. clvmd: Don't allow user operations to start until the lvm thread is fully up.
clvmd-gulm: set KEEPALIVE on sockets.
Version 2.01.08 - 22nd March 2005 Version 2.01.08 - 22nd March 2005

View File

@ -69,6 +69,7 @@ int init_comms(unsigned short port)
{ {
int one = 1; int one = 1;
setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(int)); setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(int));
setsockopt(listen_fd, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof(int));
} }
memset(&addr, 0, sizeof(addr)); // Bind to INADDR_ANY memset(&addr, 0, sizeof(addr)); // Bind to INADDR_ANY
@ -286,7 +287,7 @@ static int read_from_tcpsock(struct local_client *client, char *buf, int len, ch
else { else {
gulm_add_up_node(csid); gulm_add_up_node(csid);
/* Send it back to clvmd */ /* Send it back to clvmd */
process_message(client, buf, len, csid); process_message(client, buf, status, csid);
} }
return status; return status;
} }
@ -296,6 +297,7 @@ int gulm_connect_csid(char *csid, struct local_client **newclient)
int fd; int fd;
struct sockaddr_in6 addr; struct sockaddr_in6 addr;
int status; int status;
int one = 1;
DEBUGLOG("Connecting socket\n"); DEBUGLOG("Connecting socket\n");
fd = socket(PF_INET6, SOCK_STREAM, 0); fd = socket(PF_INET6, SOCK_STREAM, 0);
@ -327,6 +329,7 @@ int gulm_connect_csid(char *csid, struct local_client **newclient)
/* Set Close-on-exec */ /* Set Close-on-exec */
fcntl(fd, F_SETFD, 1); fcntl(fd, F_SETFD, 1);
setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof(int));
status = alloc_client(fd, csid, newclient); status = alloc_client(fd, csid, newclient);
if (status) if (status)