[12598] in Athena Bugs

home help back first fref pref prev next nref lref last post

[haynes@cats.ucsc.edu: Fix for that globalmessage problem]

daemon@ATHENA.MIT.EDU (yandros@MIT.EDU)
Wed Sep 14 01:39:14 1994

From: yandros@MIT.EDU
Date: Wed, 14 Sep 1994 01:39:07 +0500
To: bugs@MIT.EDU


  From: haynes@cats.ucsc.edu (Jim Haynes)
  Date: Tue, 13 Sep 1994 15:37:37 -0700
  To: eichin.mit.edu@cats.ucsc.edu, yandros@MIT.EDU
  Subject: Fix for that globalmessage problem

which turned out to be caused by using a multi-homed host as the server
for the message.  The original version just uses the first IP address returned
by gethostbyname(), which might not work.   This from Brian Buhrow

*** 1.3	1991/02/28 11:03:30
--- get_message_from_server.c	1994/09/13 21:43:06
***************
*** 1,7 ****
  /* This file is part of the Project Athena Global Message System.
   * Created by: Mark W. Eichin <eichin@athena.mit.edu>
   * $Source: /sysdev/source/athena/athena.bin/gms/RCS/get_message_from_server.c,v $
!  * $Author: epeisach $
   *
   *	Copyright (c) 1988 by the Massachusetts Institute of Technology.
   *	For copying and distribution information, see the file
--- 1,7 ----
  /* This file is part of the Project Athena Global Message System.
   * Created by: Mark W. Eichin <eichin@athena.mit.edu>
   * $Source: /sysdev/source/athena/athena.bin/gms/RCS/get_message_from_server.c,v $
!  * $Author: buhrow $
   *
   *	Copyright (c) 1988 by the Massachusetts Institute of Technology.
   *	For copying and distribution information, see the file
***************
*** 9,15 ****
   */
  #include <mit-copyright.h>
  #ifndef lint
! static char rcsid_get_message_from_server_c[] = "$Header: /sysdev/source/athena/athena.bin/gms/RCS/get_message_from_server.c,
v 1.3 1991/02/28 11:03:30 epeisach Exp $";
  #endif lint
  
  #include "globalmessage.h"
--- 9,15 ----
   */
  #include <mit-copyright.h>
  #ifndef lint
! static char rcsid_get_message_from_server_c[] = "$Header: /sysdev/source/athena/athena.bin/gms/RCS/get_message_from_server.c,
v 1.4 1994/09/13 21:41:53 buhrow Exp $";
  #endif lint
  
  #include "globalmessage.h"
***************
*** 26,32 ****
       char *server;
  {
    struct sockaddr_in server_insocket;
!   int sck, stat;
    char *message_data;
    int message_size;
    
--- 26,32 ----
       char *server;
  {
    struct sockaddr_in server_insocket;
!   int sck, stat, i;
    char *message_data;
    int message_size;
    
***************
*** 69,78 ****
        /* gethostbyname failed */
        return(gethost_error());
      }
!     /* Copy in the first (preferred?) address of the server */
!     bcopy(gms_host->h_addr_list[0], &server_insocket.sin_addr,
  	  gms_host->h_length); 
-   }
  
    /* Actually make the connection */
    {
--- 69,79 ----
        /* gethostbyname failed */
        return(gethost_error());
      }
!     /*Try each address, until we've exhausted all addresses*/
!     for (i = 0;gms_host->h_addr_list[i] != 0; i ++)
!     {
!     bcopy(gms_host->h_addr_list[i], &server_insocket.sin_addr,
  	  gms_host->h_length); 
  
    /* Actually make the connection */
    {
***************
*** 107,117 ****
        return(errno);
      }
      if (stat == 0) {
!       return(GMS_TIMED_OUT);
      }
      /* since we only wait on reader, it must have arrived */
    }
! 
    message_data = malloc(GMS_MAX_MESSAGE_LEN);
    stat = recv(sck, message_data, GMS_MAX_MESSAGE_LEN-1, 0);
  
--- 108,121 ----
        return(errno);
      }
      if (stat == 0) {
!       continue;
      }
+ 
      /* since we only wait on reader, it must have arrived */
+     break;
    }
!   }
!   }
    message_data = malloc(GMS_MAX_MESSAGE_LEN);
    stat = recv(sck, message_data, GMS_MAX_MESSAGE_LEN-1, 0);
  

And the rlog information is...

RCS file: RCS/get_message_from_server.c,v
Working file: get_message_from_server.c
head: 1.4
branch:
locks: strict
access list:
symbolic names:
	ATH7_4: 1.3
	ATH7_6: 1.3
	GMSTEST1: 1.1
comment leader: " * "
keyword substitution: kv
total revisions: 4;	selected revisions: 4
description:
send request to server and retrieve message (or error number)
----------------------------
revision 1.4
date: 1994/09/13 21:41:53;  author: buhrow;  state: Exp;  lines: +12 -8
Added the ability to deal with more than one address per host.
-Brian
----------------------------
revision 1.3
date: 1991/02/28 11:03:30;  author: epeisach;  state: Exp;  lines: +6 -5
Free called with wrong argument.
Received data not NULL terminated.
----------------------------
revision 1.2
date: 1990/07/12 15:15:51;  author: probe;  state: Exp;  lines: +2 -7
Removed obsolete comment (Hesiod library has been fixed)
changes.71#1075
----------------------------
revision 1.1
date: 1988/09/26 15:40:43;  author: eichin;  state: Exp;
Initial revision
=============================================================================

home help back first fref pref prev next nref lref last post