Changeset 10231


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.

Location:
trunk/gsdl/src/w32server
Files:
3 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);
  • trunk/gsdl/src/w32server/settings.cpp

    r10224 r10231  
    6666text_t gsdl_conffile;
    6767int gsdl_start_browser = 1;
     68int gsdl_address_resolution_method = 0;
    6869
    6970// private data
     
    311312    write_ini_line(fout, "collections", gsdl_collections);
    312313    write_ini_line(fout, "start_browser", text_t(gsdl_start_browser));
    313    
     314    write_ini_line(fout, "address_resolution_method", text_t(gsdl_address_resolution_method));
     315
    314316    // collection levels
    315317    colinfo_tmap::iterator here = gsdl_collectinfo.begin();
     
    466468      } else if (key == "browserexe") {
    467469        strcpy (gsdl_browser_exe, cstr_value);
     470
     471      } else if (key == "address_resolution_method") {
     472        gsdl_address_resolution_method = value.getint();
    468473
    469474      } else if (key == "collections") {
  • trunk/gsdl/src/w32server/settings.h

    r9526 r10231  
    6161extern text_t gsdl_conffile;
    6262extern int gsdl_start_browser;
     63extern int gsdl_address_resolution_method;
    6364
    6465void Settings_Dialog(HWND window, int netscapeneeded);
Note: See TracChangeset for help on using the changeset viewer.