Example #1
0
def handle_s2b_connect(line):
	global serverid, groupid, scoreid, gotconnect

	version, swname, zonename, network, password = line.split(':', 4)

	version = int(version)
	if version != 1:
		log("local server specified wrong protocol version!")
		vie_bprot.disconnect()
		util.exit(1)

	if network:
		sendname = network + ' ' + zonename
	else:
		sendname = zonename

	log("local zone %s running on %s" % (sendname, swname))

	args = [serverid, groupid, scoreid, sendname, password]
	def do_send_stuff(args=args):
		log("logging in to remote biller")
		vie_bprot.send_s2b_login(*args)
		send_b2s_connectok('bproxy %s' % util.version)

	# this is a little messy. we check to see if we've contacted the vie
	# server yet. if so, just send the connectok. if not, wait until we
	# do.
	if vie_bprot.stage == vie_bprot.s_connected:
		do_send_stuff()
	else:
		gotconnect = do_send_stuff
def handle_s2b_connect(line):
    global serverid, groupid, scoreid, gotconnect

    version, swname, zonename, network, password = line.split(':', 4)

    version = int(version)
    if version != 1:
        log("local server specified wrong protocol version!")
        vie_bprot.disconnect()
        util.exit(1)

    if network:
        sendname = network + ' ' + zonename
    else:
        sendname = zonename

    log("local zone %s running on %s" % (sendname, swname))

    args = [serverid, groupid, scoreid, sendname, password]

    def do_send_stuff(args=args):
        log("logging in to remote biller")
        vie_bprot.send_s2b_login(*args)
        send_b2s_connectok('bproxy %s' % util.version)

    # this is a little messy. we check to see if we've contacted the vie
    # server yet. if so, just send the connectok. if not, wait until we
    # do.
    if vie_bprot.stage == vie_bprot.s_connected:
        do_send_stuff()
    else:
        gotconnect = do_send_stuff
Example #3
0
def try_read():
	global inbuf

	try:
		r = sock.recv(1024)
	except:
		# probably ewouldblock
		return

	if r:
		inbuf = inbuf + r
	else:
		log("lost connection to local game server")
		vie_bprot.disconnect()
		util.exit(1)

	lines = inbuf.splitlines(1)
	inbuf = ''
	for l in lines:
		if l.endswith('\n') or l.endswith('\r'):
			process_incoming(l.strip())
		else:
			inbuf = l
def try_read():
    global inbuf

    try:
        r = sock.recv(1024)
    except:
        # probably ewouldblock
        return

    if r:
        inbuf = inbuf + r
    else:
        log("lost connection to local game server")
        vie_bprot.disconnect()
        util.exit(1)

    lines = inbuf.splitlines(1)
    inbuf = ''
    for l in lines:
        if l.endswith('\n') or l.endswith('\r'):
            process_incoming(l.strip())
        else:
            inbuf = l