1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

jlo: Too many http connections "solved"

Discussion in 'BF2Statistics discussion' started by muued, Apr 16, 2006.

  1. muued

    muued New Member

    at my PC, the problem was that the server's sv.maxplayers was set to 50 as the tutorial said. When I set it down to max 42 players the server worked fine.
    So in case anyone else got that problem edit your mods\bf2\Settings\ServerSettings.con and change the sv.maxplayers to 42 or below

    additionally, on my machine the singleplayer games wouldn't load the correct ranks/unlocks (they were logged correctly though)
    to solve that problem just start a dedicated server (bf2.exe +dedicated 1 ... ) and then run your bf2.exe with an additional "+multi 1" ... that worked for me ( thanks to PaLL3 for posting this in another thread )
     
  2. sharok

    sharok Member

    This option has no effect for me. I still get the error.
     
  3. sharok

    sharok Member

    Actually, the real solution appears to be the work The Shadow did on the playermanager code.

    If you are having these problems, just replace as I did the beginning of the def getProfileId(self): code by this :

    pid = self.profileid
    if not host.pmgr_p_get("ai", self.index) and pid == 0: # Don't bother doing this if player is 'bot
    pid = int(host.pmgr_p_get("profileid", self.index))
    self.profileid = pid

    if pid == 0:
    if pmanager_pid_handler == 1: # Try Backend playerID first - idea by ArmEagle
    if g_debug: print "Retrieving Profile ID (%s) via HTTP/1.1 miniclient" % str(host.pmgr_p_get("name", self.index))

    # URL for retrieving player ID via internal miniclient
    player_nick = string.replace(str(host.pmgr_p_get("name", self.index)), ' ', '%20')
    asp_playerid = '/ASP/bf2getplayerid.php?nick=' + player_nick
    if g_debug: print "URI: %s" % (asp_playerid)

    # Fetch Data
    data = http_get( http_backend_addr, http_backend_port, asp_playerid )

    if data and data[0] == 'O':
    if g_debug: print "Received PID data is VALID, length %d" % int(len(data))
    datalines = data.splitlines()
    pidval = datalines[2].split('\t')
    pid = int(pidval[1])
    else:
    print "Received PID data is INVALID, length %d" % int(len(data))

    # Use PID.TXT to find PlayerID
    if pid == 0: # Backend check is disabled or failed
    if g_debug: print "Retrieving Profile ID (%s) via PID file" % str(host.pmgr_p_get("name", self.index))
    try:
    fh = file(pmanager_pidtxt_path, 'rb')
    line = fh.readlines()
    fh.close()
    count = 0
    while count < len(line):
    if line[count].rstrip() == host.pmgr_p_get("name", self.index):
    pid = int(line[count + 1].rstrip())
    break
    count += 2
    # create a new PID - idea by FiberLetalis
    if pid == 0:
    if g_debug: print "New player, creating Profile ID..."
    new_pid = int(line[count - 1].rstrip()) + 1
    fh = file(pmanager_pidtxt_path, 'ab')
    fh.write('\r\n' + host.pmgr_p_get("name", self.index) + '\r\n' + str(new_pid))
    fh.close()
    pid = new_pid
    except IOError:
    print 'PID file not found!'

    self.profileid = pid
    return pid
    else:
    return pid

    This is The Shadow's code, and he has done a bang-up great job of solving this nagging problem. His code is for 1.3RC1, but it works fine with a version 1.2 script, as I can attest.
     
  4. shadow42

    shadow42 Member

    Glad you like. ;) I did lots of head banging trying solve this sod of a problem. !shy