vol: remove SYNC fatal_error processing
[openafs.git] / src / vol / daemon_com.h
index fee96e8..dabaf3b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2006-2008, Sine Nomine Associates and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
@@ -10,7 +10,7 @@
 #ifndef _AFS_VOL_DAEMON_COM_H
 #define _AFS_VOL_DAEMON_COM_H 1
 
-/* 
+/*
  * SYNC protocol constants
  */
 
@@ -22,7 +22,7 @@
 #define SYNC_COM_CODE_USER_BASE 65536
 #define SYNC_COM_CODE_DECL(code) (SYNC_COM_CODE_USER_BASE+(code))
 
-/** 
+/**
  * general command codes.
  */
 enum SYNCOpCode {
@@ -33,7 +33,7 @@ enum SYNCOpCode {
 
 /* SYNC protocol response codes
  *
- * response codes 0-65535 are reserved for 
+ * response codes 0-65535 are reserved for
  * global SYNC package response codes
  */
 #define SYNC_RES_CODE_USER_BASE 65536
@@ -87,6 +87,15 @@ enum SYNCReasonCode {
     afs_int64 _##buf##_l[SYNC_PROTO_MAX_LEN/sizeof(afs_int64)]; \
     char * buf = (char *)(_##buf##_l)
 
+#ifdef AFS_LINUX26_ENV
+/* Some Linux kernels have a bug where we are not woken up immediately from a
+ * select() when data is available. Work around this by having a low select()
+ * timeout, so we don't hang in those situations. */
+# define SYNC_SELECT_TIMEOUT 10
+#else
+# define SYNC_SELECT_TIMEOUT 86400
+#endif
+
 #ifdef USE_UNIX_SOCKETS
 #include <afs/afsutil.h>
 #include <sys/un.h>
@@ -114,7 +123,7 @@ typedef struct SYNC_endpoint {
  * SYNC server state structure.
  */
 typedef struct SYNC_server_state {
-    int fd;                     /**< listening socket descriptor */
+    osi_socket fd;              /**< listening socket descriptor */
     SYNC_endpoint_t endpoint;   /**< server endpoint address */
     afs_uint32 proto_version;   /**< our protocol version */
     int bind_retry_limit;       /**< upper limit on times to retry socket bind() */
@@ -129,13 +138,12 @@ typedef struct SYNC_server_state {
  * SYNC client state structure.
  */
 typedef struct SYNC_client_state {
-    int fd;                     /**< client socket descriptor */
+    osi_socket fd;              /**< client socket descriptor */
     SYNC_endpoint_t endpoint;   /**< address of sync server */
     afs_uint32 proto_version;   /**< our protocol version */
     int retry_limit;            /**< max number of times for SYNC_ask to retry */
     afs_int32 hard_timeout;     /**< upper limit on time to keep trying */
     char * proto_name;          /**< sync protocol associated with this conn */
-    byte fatal_error;           /**< nonzero if fatal error on this client conn */
     afs_uint32 pkt_seq;         /**< packet xmit sequence counter */
     afs_uint32 com_seq;         /**< command xmit sequence counter */
 } SYNC_client_state;
@@ -192,7 +200,7 @@ typedef struct SYNC_response {
 } SYNC_response;
 
 /* general prototypes */
-extern int SYNC_getSock(SYNC_endpoint_t * endpoint);
+extern osi_socket SYNC_getSock(SYNC_endpoint_t * endpoint);
 extern void SYNC_getAddr(SYNC_endpoint_t * endpoint, SYNC_sockaddr_t * addr);
 
 /* client-side prototypes */
@@ -203,8 +211,8 @@ extern afs_int32 SYNC_closeChannel(SYNC_client_state *);  /* do a graceful chann
 extern int SYNC_reconnect(SYNC_client_state *);           /* do a reconnect after a protocol error, or from a forked child */
 
 /* server-side prototypes */
-extern int SYNC_getCom(SYNC_server_state_t *, int fd, SYNC_command * com);
-extern int SYNC_putRes(SYNC_server_state_t *, int fd, SYNC_response * res);
+extern int SYNC_getCom(SYNC_server_state_t *, osi_socket fd, SYNC_command * com);
+extern int SYNC_putRes(SYNC_server_state_t *, osi_socket fd, SYNC_response * res);
 extern int SYNC_verifyProtocolString(char * buf, size_t len);
 extern void SYNC_cleanupSock(SYNC_server_state_t * state);
 extern int SYNC_bindSock(SYNC_server_state_t * state);