Ignore:
Timestamp:
2005-07-08T11:54:05+12:00 (19 years ago)
Author:
mdewsnip
Message:

Added some alternative methods of resolving the address the local library will attempt to load, since many people have reported problems with the existing method lately. The first new method determines the IP but doesn't resolve it to a name, and the second new method always uses "127.0.0.1". This option is controlled using the "address_resolution_method" option in the Local Library gsdlsite.cfg file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/w32server/fnord.cpp

    r9636 r10231  
    330330
    331331  // get the url and attempt to start a browser
    332   char *localname = GetLocalName(NULL);
    333332  if (have_networking) {
    334     text_t url = "http://" + text_t(localname);
     333    // There are now three address resolution methods:
     334    //   0: Standard -- get local IP then resolve to a name
     335    //   1: IP only -- as above, but use IP only -- don't resolve to a name
     336    //   2: 127.0.0.1 -- always use 127.0.0.1
     337    char gsdl_address[100];
     338
     339    DWORD local_ip = GetLocalIP();
     340    if (local_ip == INADDR_ANY || gsdl_address_resolution_method == 2) {
     341      local_ip = 127 + (0 << 8) + (0 << 16) + (1 << 24);
     342    }
     343
     344    if (gsdl_address_resolution_method == 1 || gsdl_address_resolution_method == 2) {
     345      sprintf(gsdl_address, "%d.%d.%d.%d", local_ip & 0xFF, (local_ip >> 8) & 0xFF, (local_ip >> 16) & 0xFF, (local_ip >> 24) & 0xFF);
     346    }
     347    else {
     348      strcpy(gsdl_address, GetLocalName(NULL));
     349    }
     350
     351    text_t url = "http://" + text_t(gsdl_address);
    335352
    336353    gsdl_url = url;
     
    10581075    exit (0);
    10591076  }
    1060  
     1077
    10611078  if (!gsdl_init()) // quit if can't initialise the library correctly
    10621079    exit (0);
Note: See TracChangeset for help on using the changeset viewer.