Exemple #1
0
def establishInboundConnection(node, serverState):
    conf=ServerConf()

    for i in range(0, conf.getNumPersistentConnections()):
        try:
            message = PersistentServerMessage(node, conf)
            socket = message.persistIncomingConnection()
            serverState.addReadableSocket(socket)
            node.addInboundConnection()


        except ServerConnectionError as e:
            #The node is not reachable at this moment,
            # no need to throw an exception since we are marking the node
            # as unreachable ins ServerConnectionHandler
            log.log(cpc.util.log.TRACE, "Exception when establishing "
                                        "inbound connections: %s " % e)
            break

    if node.isConnectedInbound():
        log.log(cpc.util.log.TRACE, "Established inbound "
                                "connections to server "
                                "%s" % node.toString())
    else:
        log.log(cpc.util.log.TRACE, "Could not establish inbound "
                                "connections to server "
                                "%s" % node.toString())
Exemple #2
0
def establishInboundConnection(node, serverState):
    conf = ServerConf()

    for i in range(0, conf.getNumPersistentConnections()):
        try:
            message = PersistentServerMessage(node, conf)
            socket = message.persistIncomingConnection()
            serverState.addReadableSocket(socket)
            node.addInboundConnection()

        except ServerConnectionError as e:
            #The node is not reachable at this moment,
            # no need to throw an exception since we are marking the node
            # as unreachable ins ServerConnectionHandler
            log.log(
                cpc.util.log.TRACE, "Exception when establishing "
                "inbound connections: %s " % e)
            break

    if node.isConnectedInbound():
        log.log(
            cpc.util.log.TRACE, "Established inbound "
            "connections to server "
            "%s" % node.toString())
    else:
        log.log(
            cpc.util.log.TRACE, "Could not establish inbound "
            "connections to server "
            "%s" % node.toString())
Exemple #3
0
def establishOutboundConnection(node):
    conf = ServerConf()

    for i in range(0, conf.getNumPersistentConnections()):
        try:
            #This will make a regular call, the connection pool will take
            # care of the rest
            message = PersistentServerMessage(node, conf)
            resp = message.persistOutgoingConnection()
            node.addOutboundConnection()

        except ServerConnectionError as e:
            #The node is not reachable at this moment,
            # no need to throw an exception since we are marking the node
            # as unreachable in ServerConnection
            log.log(cpc.util.log.TRACE, "Exception when establishing "
                                        "outgoing connections: %s " % e)
            break

    if node.isConnectedOutbound():
        log.log(cpc.util.log.TRACE,"Established outgoing "
                                   "connections to server "
                                   "%s"%node.toString())

    else:
        log.log(cpc.util.log.TRACE,"Could not establish outgoing "
                                   "connections to %s"%node.toString())
Exemple #4
0
def establishOutboundConnection(node):
    conf = ServerConf()

    for i in range(0, conf.getNumPersistentConnections()):
        try:
            #This will make a regular call, the connection pool will take
            # care of the rest
            message = PersistentServerMessage(node, conf)
            resp = message.persistOutgoingConnection()
            node.addOutboundConnection()

        except ServerConnectionError as e:
            #The node is not reachable at this moment,
            # no need to throw an exception since we are marking the node
            # as unreachable in ServerConnection
            log.log(
                cpc.util.log.TRACE, "Exception when establishing "
                "outgoing connections: %s " % e)
            break

    if node.isConnectedOutbound():
        log.log(
            cpc.util.log.TRACE, "Established outgoing "
            "connections to server "
            "%s" % node.toString())

    else:
        log.log(
            cpc.util.log.TRACE, "Could not establish outgoing "
            "connections to %s" % node.toString())