Rename socket_is_still_usable() to socket_is_still_alive().
authorFabian Keil <fk@fabiankeil.de>
Fri, 23 Apr 2010 11:53:48 +0000 (11:53 +0000)
committerFabian Keil <fk@fabiankeil.de>
Fri, 23 Apr 2010 11:53:48 +0000 (11:53 +0000)
The fact that a socket is still alive doesn't mean that it's
still (re)usable and given that the function only checks the
former, the previous name was a bit misleading.

gateway.c
jbsockets.c
jbsockets.h
jcc.c

index 3049530..b3dff39 100644 (file)
--- a/gateway.c
+++ b/gateway.c
@@ -1,4 +1,4 @@
-const char gateway_rcs[] = "$Id: gateway.c,v 1.63 2009/10/01 16:07:33 fabiankeil Exp $";
+const char gateway_rcs[] = "$Id: gateway.c,v 1.64 2009/10/03 10:37:49 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/gateway.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/gateway.c,v $
@@ -444,7 +444,7 @@ int close_unusable_connections(void)
             close_socket(reusable_connection[slot].sfd);
             mark_connection_closed(&reusable_connection[slot]);
          }
             close_socket(reusable_connection[slot].sfd);
             mark_connection_closed(&reusable_connection[slot]);
          }
-         else if (!socket_is_still_usable(reusable_connection[slot].sfd))
+         else if (!socket_is_still_alive(reusable_connection[slot].sfd))
          {
             log_error(LOG_LEVEL_CONNECT,
                "The connection to %s:%d in slot %d is no longer usable. "
          {
             log_error(LOG_LEVEL_CONNECT,
                "The connection to %s:%d in slot %d is no longer usable. "
index f564273..b234b20 100644 (file)
@@ -1,4 +1,4 @@
-const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.71 2009/12/16 08:35:47 fabiankeil Exp $";
+const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.72 2010/02/15 15:14:10 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jbsockets.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jbsockets.c,v $
@@ -1209,9 +1209,9 @@ unsigned long resolve_hostname_to_ip(const char *host)
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
 /*********************************************************************
  *
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
 /*********************************************************************
  *
- * Function    :  socket_is_still_usable
+ * Function    :  socket_is_still_alive
  *
  *
- * Description :  Decides whether or not an open socket is still usable.
+ * Description :  Figures out whether or not a socket is still alive.
  *
  * Parameters  :
  *          1  :  sfd = The socket to check.
  *
  * Parameters  :
  *          1  :  sfd = The socket to check.
@@ -1219,7 +1219,7 @@ unsigned long resolve_hostname_to_ip(const char *host)
  * Returns     :  TRUE for yes, otherwise FALSE.
  *
  *********************************************************************/
  * Returns     :  TRUE for yes, otherwise FALSE.
  *
  *********************************************************************/
-int socket_is_still_usable(jb_socket sfd)
+int socket_is_still_alive(jb_socket sfd)
 {
    char buf[10];
    int no_data_waiting;
 {
    char buf[10];
    int no_data_waiting;
index ac982ed..f19968c 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef JBSOCKETS_H_INCLUDED
 #define JBSOCKETS_H_INCLUDED
 #ifndef JBSOCKETS_H_INCLUDED
 #define JBSOCKETS_H_INCLUDED
-#define JBSOCKETS_H_VERSION "$Id: jbsockets.h,v 1.15 2009/05/10 10:12:30 fabiankeil Exp $"
+#define JBSOCKETS_H_VERSION "$Id: jbsockets.h,v 1.16 2009/05/16 13:27:20 fabiankeil Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jbsockets.h,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jbsockets.h,v $
@@ -62,7 +62,7 @@ extern void get_host_information(jb_socket afd, char **ip_address, char **hostna
 
 extern unsigned long resolve_hostname_to_ip(const char *host);
 
 
 extern unsigned long resolve_hostname_to_ip(const char *host);
 
-extern int socket_is_still_usable(jb_socket sfd);
+extern int socket_is_still_alive(jb_socket sfd);
 
 /* Revision control strings from this header and associated .c file */
 extern const char jbsockets_rcs[];
 
 /* Revision control strings from this header and associated .c file */
 extern const char jbsockets_rcs[];
diff --git a/jcc.c b/jcc.c
index 3b0ba8f..22e59ec 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.314 2010/04/03 13:21:53 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.315 2010/04/12 16:51:31 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -1724,7 +1724,7 @@ static void chat(struct client_state *csp)
 
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
    if ((csp->server_connection.sfd != JB_INVALID_SOCKET)
 
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
    if ((csp->server_connection.sfd != JB_INVALID_SOCKET)
-      && socket_is_still_usable(csp->server_connection.sfd)
+      && socket_is_still_alive(csp->server_connection.sfd)
       && connection_destination_matches(&csp->server_connection, http, fwd))
    {
       log_error(LOG_LEVEL_CONNECT,
       && connection_destination_matches(&csp->server_connection, http, fwd))
    {
       log_error(LOG_LEVEL_CONNECT,
@@ -2028,7 +2028,7 @@ static void chat(struct client_state *csp)
       if (FD_ISSET(csp->server_connection.sfd, &rfds))
       {
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
       if (FD_ISSET(csp->server_connection.sfd, &rfds))
       {
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
-         if (!socket_is_still_usable(csp->cfd))
+         if (!socket_is_still_alive(csp->cfd))
          {
 #ifdef _WIN32
             log_error(LOG_LEVEL_CONNECT,
          {
 #ifdef _WIN32
             log_error(LOG_LEVEL_CONNECT,
@@ -2533,7 +2533,7 @@ static void serve(struct client_state *csp)
       if (continue_chatting && !(csp->flags & CSP_FLAG_CRUNCHED))
       {
          continue_chatting = (csp->server_connection.sfd != JB_INVALID_SOCKET)
       if (continue_chatting && !(csp->flags & CSP_FLAG_CRUNCHED))
       {
          continue_chatting = (csp->server_connection.sfd != JB_INVALID_SOCKET)
-            && socket_is_still_usable(csp->server_connection.sfd);
+            && socket_is_still_alive(csp->server_connection.sfd);
          if (continue_chatting)
          {
             if (!(csp->flags & CSP_FLAG_SERVER_KEEP_ALIVE_TIMEOUT_SET))
          if (continue_chatting)
          {
             if (!(csp->flags & CSP_FLAG_SERVER_KEEP_ALIVE_TIMEOUT_SET))
@@ -2568,7 +2568,7 @@ static void serve(struct client_state *csp)
          }
          if ((csp->flags & CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE)
             && data_is_available(csp->cfd, (int)client_timeout)
          }
          if ((csp->flags & CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE)
             && data_is_available(csp->cfd, (int)client_timeout)
-            && socket_is_still_usable(csp->cfd))
+            && socket_is_still_alive(csp->cfd))
          {
             log_error(LOG_LEVEL_CONNECT, "Client request arrived in "
                "time or the client closed the connection on socket %d.",
          {
             log_error(LOG_LEVEL_CONNECT, "Client request arrived in "
                "time or the client closed the connection on socket %d.",
@@ -2606,7 +2606,7 @@ static void serve(struct client_state *csp)
                 csp->cfd);
 #ifdef FEATURE_CONNECTION_SHARING
             if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_SHARING)
                 csp->cfd);
 #ifdef FEATURE_CONNECTION_SHARING
             if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_SHARING)
-               && (socket_is_still_usable(csp->server_connection.sfd)))
+               && (socket_is_still_alive(csp->server_connection.sfd)))
             {
                time_t time_open = time(NULL) - csp->server_connection.timestamp;
 
             {
                time_t time_open = time(NULL) - csp->server_connection.timestamp;