vol: remove SYNC fatal_error processing
[openafs.git] / src / vol / daemon_com.c
index 26d5cb7..0ae1e2b 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
-
-#include <sys/types.h>
-#include <stdio.h>
-#ifdef AFS_NT40_ENV
-#include <winsock2.h>
-#include <time.h>
-#else
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/time.h>
-#include <unistd.h>
-#endif
-#include <errno.h>
-#include <afs/afs_assert.h>
-#include <signal.h>
-#include <string.h>
-
+#include <roken.h>
+#include <afs/opr.h>
 
 #include <rx/xdr.h>
 #include <afs/afsint.h>
-#include "nfs.h"
 #include <afs/errors.h>
+
+#include "nfs.h"
 #include "daemon_com.h"
 #include "lwp.h"
 #include "lock.h"
@@ -189,11 +173,7 @@ SYNC_connect(SYNC_client_state * state)
 int
 SYNC_disconnect(SYNC_client_state * state)
 {
-#ifdef AFS_NT40_ENV
-    closesocket(state->fd);
-#else
-    close(state->fd);
-#endif
+    rk_closesocket(state->fd);
     state->fd = OSI_NULLSOCKET;
     return 0;
 }
@@ -275,16 +255,11 @@ SYNC_ask(SYNC_client_state * state, SYNC_command * com, SYNC_response * res)
     int tries;
     afs_uint32 now, timeout, code=SYNC_OK;
 
-    if (state->fatal_error) {
-       return SYNC_COM_ERROR;
-    }
-
     if (state->fd == OSI_NULLSOCKET) {
        SYNC_connect(state);
     }
 
     if (state->fd == OSI_NULLSOCKET) {
-       state->fatal_error = 1;
        return SYNC_COM_ERROR;
     }
 
@@ -320,10 +295,9 @@ SYNC_ask(SYNC_client_state * state, SYNC_command * com, SYNC_response * res)
     }
 
     if (code == SYNC_COM_ERROR) {
-       Log("SYNC_ask: fatal protocol error on circuit '%s'; disabling sync "
-           "protocol until next server restart\n",
-           state->proto_name);
-       state->fatal_error = 1;
+       Log("SYNC_ask: too many / too latent fatal protocol errors on circuit "
+           "'%s'; giving up (tries %d timeout %d)\n",
+           state->proto_name, tries, timeout);
     }
 
     return code;
@@ -630,7 +604,7 @@ SYNC_verifyProtocolString(char * buf, size_t len)
 {
     size_t s_len;
 
-    s_len = afs_strnlen(buf, len);
+    s_len = strnlen(buf, len);
 
     return (s_len == len) ? 1 : 0;
 }