Exemple #1
0
def normal(lat, lon, cir, serv_ip, network_type):
    print("normal mode")
    print(lat)
    print(lon)
    print(cir)
    print(serv_ip)
    print(network_type)

    global is_results_already_sent
    is_results_already_sent = False

    ip = re.split(",", serv_ip)
    if ip is not None:
        global server_uuid
        server_uuid = ip[1]

        global server_ip
        server_ip = ip[0]

    global net_type
    net_type = network_type

    global ws_url
    ws_url = "ws://" + server_ip + ":3001"

    set_location(lat, lon)

    #####CALL NORMAL MODE HERE#####
    global dev_hash
    print("hash: {}\n".format(dev_hash))
    successful_result = False
    try:
        results = queue_process.join_queue(NORMAL_MODE, server_ip, dev_hash,
                                           cir)
        if results is not None and results[0][0] is not None:
            eel.printnormal(results[0][0])
            successful_result = True
        else:
            eel.print_test_error(
                "An unexpected error occurred.\nPlease select the test mode again, or refresh this app by pressing F5."
            )
    except error as Exception:
        eel.print_test_error(error)

    eel.progress_now(100, "true")
    eel.printprogress("Done")

    if successful_result:
        send_res(results[0], 'normal', lat, lon)
def normal(lat, lon, cir, serv_ip, network_type):
    print("normal mode")

    ip = re.split(",", serv_ip)
    global server_uuid
    server_uuid = ip[1]
    global server_ip
    server_ip = ip[0]
    global net_type
    net_type = network_type

    global ws_url
    ws_url = "ws://" + server_ip + ":3001"

    set_location(lat, lon)

    #####CALL NORMAL MODE HERE#####
    global dev_hash
    results = queue_process.join_queue(NORMAL_MODE, server_ip, dev_hash)
    eel.printnormal(results[0][0])
def rev(lat, lon, cir, serv_ip, network_type):
    print("reverse mode")

    ip = re.split(",", serv_ip)
    global server_uuid
    server_uuid = ip[1]
    global server_ip
    server_ip = ip[0]
    global net_type
    net_type = network_type

    global ws_url
    ws_url = "ws://" + server_ip + ":3001"

    set_location(lat, lon)

    #####CALL REVERSE MODE HERE#####
    #results = queue_process.join_queue(REVERSE_MODE, server_ip)
    global dev_hash
    results = queue_process.join_queue(REVERSE_MODE, server_ip, dev_hash)
    eel.printreverse(results)
Exemple #4
0
import queue_process
from constants import *
import sys







if __name__ == "__main__":
    n = int(sys.argv[1])
    tempfile = open("temporary_test","w+")
    average_rtt = 0
    average_tcp = 0
    total = 0
    for x in range(0,n):
        #results = queue_process.join_queue(NORMAL_MODE, DEFAULT_SERVER, "random_hash", int(sys.argv[2]))[0][0]
        results = queue_process.join_queue(REVERSE_MODE, DEFAULT_SERVER, "random_hash", int(sys.argv[2]))[0][0]
        try:
            average_rtt += float(results['RTT'])
            average_tcp += float(results['THPT_AVG'])
            total += 1
        except:
            pass
        tempfile.write("\n"+str(results)+"\n")

    print(str(average_rtt/total))
    print(str(average_tcp/total))