more trying to reuse socket addresses when stuck.

This commit is contained in:
gardners 2012-05-17 13:13:42 +09:30
parent fa8825a3ec
commit 844a480ae7
2 changed files with 23 additions and 2 deletions

View File

@ -99,6 +99,14 @@ int monitor_setup_sockets()
return -1;
}
int reuseP=1;
if(setsockopt( monitor_named_socket, SOL_SOCKET, SO_REUSEADDR,
&reuseP, sizeof(reuseP)) < 0)
{
WHY("Could not indicate reuse addresses. Not necessarily a problem (yet)");
WHY_perror("setsockopt");
}
int send_buffer_size=64*1024;
int res = setsockopt(monitor_named_socket, SOL_SOCKET, SO_RCVBUF,
&send_buffer_size, sizeof(send_buffer_size));

View File

@ -48,6 +48,13 @@ int overlay_mdp_setup_sockets()
mdp_abstract_socket = socket(AF_UNIX, SOCK_DGRAM, 0);
if (mdp_abstract_socket>-1) {
int dud=0;
int reuseP=1;
if(setsockopt( mdp_abstract_socket, SOL_SOCKET, SO_REUSEADDR,
&reuseP, sizeof(reuseP)) < 0)
{
WHY("Could not indicate reuse addresses. Not necessarily a problem (yet)");
WHY_perror("setsockopt");
}
int r=bind(mdp_abstract_socket, (struct sockaddr *)&name, len);
if (r) { dud=1; r=0; WHY("bind() of abstract name space socket failed (not an error on non-linux systems"); }
if (dud) {
@ -60,7 +67,6 @@ int overlay_mdp_setup_sockets()
int res = setsockopt(mdp_abstract_socket, SOL_SOCKET, SO_SNDBUF,
&send_buffer_size, sizeof(send_buffer_size));
}
}
#endif
if (mdp_named_socket==-1) {
@ -72,6 +78,13 @@ int overlay_mdp_setup_sockets()
mdp_named_socket = socket(AF_UNIX, SOCK_DGRAM, 0);
if (mdp_named_socket>-1) {
int dud=0;
int reuseP=1;
if(setsockopt( mdp_named_socket, SOL_SOCKET, SO_REUSEADDR,
&reuseP, sizeof(reuseP)) < 0)
{
WHY("Could not indicate reuse addresses. Not necessarily a problem (yet)");
WHY_perror("setsockopt");
}
int r=bind(mdp_named_socket, (struct sockaddr *)&name, len);
if (r) { dud=1; r=0; WHY("bind() of named unix domain socket failed"); }
if (dud) {