Difference for socket/metaserver.c from version 1.6 to 1.7


version 1.6 version 1.7
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_metaserver_c =   * static char *rcsid_metaserver_c =
  *    "$Id: metaserver.c,v 1.6 2000/12/04 00:40:06 cvs Exp $";   *    "$Id: metaserver.c,v 1.7 2001/04/06 00:43:52 michtoen Exp $";
  */   */
   
 /*  /*
Line 25
 
Line 25
   
     The author can be reached via e-mail to mwedel@scruz.net      The author can be reached via e-mail to mwedel@scruz.net
 */  */
   #include <global.h>
   
   #ifndef WIN32 //---win32 exclude unix header files
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/socket.h>  #include <sys/socket.h>
 #include <netinet/in.h>  #include <netinet/in.h>
 #include <netdb.h>  #include <netdb.h>
 #include <arpa/inet.h>  #include <arpa/inet.h>
   
 #include <global.h>  
 #include <version.h>  #include <version.h>
   #endif // end win32
   
 static int metafd=-1;  static int metafd=-1;
 static struct sockaddr_in sock;  static struct sockaddr_in sock;
Line 45
 
Line 48
 void metaserver_init()  void metaserver_init()
 {  {
   
   #ifdef WIN32 // ***win32 metaserver_init(): init win32 socket
    struct hostent *hostbn;
    int temp = 1;
   #endif
   
     if (!settings.meta_on) {      if (!settings.meta_on) {
  metafd=-1;   metafd=-1;
  return;   return;
Line 60
 
Line 68
  }   }
  memcpy(&sock.sin_addr, hostbn->h_addr, hostbn->h_length);   memcpy(&sock.sin_addr, hostbn->h_addr, hostbn->h_length);
     }      }
   #ifdef WIN32 // ***win32 metaserver_init(): init win32 socket
    ioctlsocket(metafd, FIONBIO , &temp);
   #else
     fcntl(metafd, F_SETFL, O_NONBLOCK);      fcntl(metafd, F_SETFL, O_NONBLOCK);
   #endif
     if ((metafd=socket(AF_INET, SOCK_DGRAM, 0))==-1) {      if ((metafd=socket(AF_INET, SOCK_DGRAM, 0))==-1) {
  LOG(llevDebug,"metaserver_init: Unable to create socket, err %d\n", errno);   LOG(llevDebug,"metaserver_init: Unable to create socket, err %d\n", errno);
  return;   return;
Line 83
 
Line 95
      LOG(llevDebug,"metaserver_init: gethostname failed - will not report hostname\n");       LOG(llevDebug,"metaserver_init: gethostname failed - will not report hostname\n");
      return;       return;
  }   }
   
   #ifdef WIN32 // ***win32 metaserver_init(): gethostbyname!
    hostbn = gethostbyname(hostname);
    if (hostbn != (struct hostent *) NULL) // quick hack
    memcpy(domain, hostbn->h_addr, hostbn->h_length);
   
    if (hostbn == (struct hostent *) NULL) {
   #else
  if (getdomainname(domain, MAX_BUF-1)) {   if (getdomainname(domain, MAX_BUF-1)) {
   #endif // win32
      LOG(llevDebug,"metaserver_init: getdomainname failed - will not report hostname\n");       LOG(llevDebug,"metaserver_init: getdomainname failed - will not report hostname\n");
      return;       return;
  }   }
Line 109
 
Line 130
   
     sprintf(data,"%s|%d|%s|%s", settings.meta_host, num_players, VERSION,       sprintf(data,"%s|%d|%s|%s", settings.meta_host, num_players, VERSION,
      settings.meta_comment);       settings.meta_comment);
   #ifdef WIN32 // ---win32 metaserver_init(): this removes a warning
       if (sendto(metafd, data, strlen(data), 0, (struct sockaddr *)&sock, sizeof(sock))<0) {
   #else
     if (sendto(metafd, data, strlen(data), 0, &sock, sizeof(sock))<0) {      if (sendto(metafd, data, strlen(data), 0, &sock, sizeof(sock))<0) {
   #endif
  LOG(llevDebug,"metaserver_update: sendto failed, err = %d\n", errno);   LOG(llevDebug,"metaserver_update: sendto failed, err = %d\n", errno);
     }      }
 }  }


Legend:
line(s) removed in v.1.6 
line(s) changed
 line(s) added in v.1.7

File made using version 1.98 of cvs2html by leaf at 2011-07-21 19:36