Пример #1
0
def main():
    """run the test"""
    init_logging()
    tcpserver = TCPServer()
    start_new_thread(server, (tcpserver,))
    sleep(1)
    test = TCPClient('127.0.0.1')
    ccon = test.connect()
    ccon.rpc_call("help")
Пример #2
0
def main():
    """run the test"""
    init_logging()
    tcpserver = TCPServer()
    start_new_thread(server, (tcpserver, ))
    sleep(1)
    test = TCPClient('127.0.0.1')
    ccon = test.connect()
    ccon.rpc_call("help")
Пример #3
0
 def handleHiiMessage(self,  msg,  connection):
     print "Core: analiza wiadomosci Hii"
     for nodeFromVector in msg['VECTOR']:
         print "Core: dodaje wezel z wiadomosci hi: '%s'" % nodeFromVector
         self.__model.addNode(nodeFromVector['UID'],  nodeFromVector['USERNAME'],  nodeFromVector['IP_ADDRESS'])
     print "Core: mapuje wezel %s na polaczenie %s" % (msg['UID'],  connection)
     if not self.__tcpm.mapNodeToConnection(msg['UID'],  connection):
         print "Core: zamykam polaczenie bo już mam takie polaczenie"
         connection.transport.loseConnection()
         return
     if self.__model.getPreferredNodesAddr():
         #uzytkownik podal z palca adres wiec w opoiedzi na HII wysylamy LOG
         self.__doLog()
     for uid in self.__model.getListOfNodes():
         if not uid in self.__tcpm.getNodesWithConnections():
             TCPClient.startReversedTCPConnection(self.__reactor,  self.__model.getIPByUID(uid))
Пример #4
0
 def handleUserInsertedNick(self,  nick):
         #Logowanie uzytkownika
         self.__model.setNick(nick)
         print ("Core: logowanie z nickiem %s" % nick)
         self.__model.setMyId(Hash.generateUserId(nick))
         try:
             print "Core: tworze serwer TCP"
             self.tcpFactory = TCPServer.startTCPServer(self.__reactor)
             netAddr = self.__model.getPreferredNodesAddr()
             if netAddr:
                 print "Core: tworze klienta tcp do polaczenia do %s" % netAddr
                 TCPClient.startReversedTCPConnection(self.__reactor,  netAddr)
             else:
                 print "Core: tworze klienta broadcast"
                 self.broadcastSender = BroadcastSender.startSender(self.__reactor)
         except socket.error as err:
             print("Core: nie można uruchomić zerwer TCP lub wyslac rozgloszenia")
             traceback.print_exc()
             sys.exit()
Пример #5
0
        help="Process DB in chunks of this size [default: 0 (infinity)]")
    parser.add_argument(
        "--CONTROL",
        action="store_true",
        help="Validate results. DISABLE DURING EVAL! [default: False]")
    args = parser.parse_args()

    if not args.CONTROL:
        print "WARNING: Eval mode - not checking correctness of results"

    if not args.Cc:
        args.Cc = multiprocessing.cpu_count()
    print "Using {} CPUs".format(args.Cc)

    with Timer(logstring="Init client"):
        peer = TCPClient(args.address, args.port)
        t3c = Task3Client(peer, args.n, args.m, 2**args.q, args.Cc,
                          args.chunksize)
    print

    print "Preprocessing"
    with Timer(logstring="Setup total time") as t:
        t3c.setup()
    print

    for i in range(args.qrycnt):
        print "Query", i
        with Timer(logstring="    Total".format(i)) as t:
            t3c.query(i, args.blowup)
        print
        t3c.benchmarks['c_qry_total'] = (t.secs, 0, 0)
Пример #6
0
 def handleReceivedBroadcastPacket(self,  fromIP):
     print "Core: ktos chce abysmy podlaczyli sie do niego"
     if self.__tcpm.isNotConnectingToIp(fromIP):
         print "Core: nie mam do niego polaczenie wiec tworze je %s" % fromIP
         TCPClient.startTCPConnection(self.__reactor,  fromIP)