Пример #1
0
    def removeBinding(self, connection):
        _SMPPBindManager.removeBinding(self, connection)

        # Update CnxStatus
        self.user.getCnxStatus().smpps['unbind_count'] += 1
        self.user.getCnxStatus().smpps['bound_connections_count'][str(
            connection.bind_type)] -= 1
Пример #2
0
    def addBinding(self, connection):
        _SMPPBindManager.addBinding(self, connection)

        # Update CnxStatus
        self.user.CnxStatus.smpps['bind_count'] += 1
        self.user.CnxStatus.smpps['bound_connections_count'][str(
            connection.bind_type)] += 1
Пример #3
0
    def __init__(self, user):
        _SMPPBindManager.__init__(self, system_id=user.username)

        self.user = user
Пример #4
0
    def removeBinding(self, connection):
        _SMPPBindManager.removeBinding(self, connection)

        # Update CnxStatus
        self.user.getCnxStatus().smpps['unbind_count']+= 1
        self.user.getCnxStatus().smpps['bound_connections_count'][str(connection.bind_type)]-= 1
Пример #5
0
    def __init__(self, user):
        _SMPPBindManager.__init__(self, system_id = user.username)

        self.user = user
Пример #6
0
    def test_getNextBindingForDelivery(self):
        bm = SMPPBindManager('blah')
        
        # add an initial rx
        mk_server_cnxn_rx1 = _makeMockServerConnection('blah', pdu_types.CommandId.bind_receiver)
        bm.addBinding(mk_server_cnxn_rx1)
        
        # Get the only rx
        deliverer = bm.getNextBindingForDelivery()
        self.assertEqual(mk_server_cnxn_rx1, deliverer)
        
        # Get the only rx again
        deliverer = bm.getNextBindingForDelivery()
        self.assertEqual(mk_server_cnxn_rx1, deliverer)
        
        # Add a new rx
        mk_server_cnxn_rx2 = _makeMockServerConnection('blah', pdu_types.CommandId.bind_receiver)
        bm.addBinding(mk_server_cnxn_rx2)
        
        # Get the new rx
        deliverer = bm.getNextBindingForDelivery()
        self.assertEqual(mk_server_cnxn_rx2, deliverer)
        
        # Expect the original rx again
        deliverer = bm.getNextBindingForDelivery()
        self.assertEqual(mk_server_cnxn_rx1, deliverer)
        
        # Add a new tx - shouldn't affect deliverer selection at all
        mk_server_cnxn_tx1 = _makeMockServerConnection('blah', pdu_types.CommandId.bind_transmitter)
        bm.addBinding(mk_server_cnxn_tx1)
        
        # Expect the 2nd rx again
        deliverer = bm.getNextBindingForDelivery()
        self.assertEqual(mk_server_cnxn_rx2, deliverer)

        # Add a new trx
        mk_server_cnxn_trx1 = _makeMockServerConnection('blah', pdu_types.CommandId.bind_transceiver)
        bm.addBinding(mk_server_cnxn_trx1)
    
        # Expect the new trx
        deliverer = bm.getNextBindingForDelivery()
        self.assertEqual(mk_server_cnxn_trx1, deliverer)
        
        # Remove the 1st rx
        bm.removeBinding(mk_server_cnxn_rx1)
        
        # Expect the 2nd rx again
        deliverer = bm.getNextBindingForDelivery()
        self.assertEqual(mk_server_cnxn_rx2, deliverer)
        
        # Expect the new trx
        deliverer = bm.getNextBindingForDelivery()
        self.assertEqual(mk_server_cnxn_trx1, deliverer)
        
        # Expect the 2nd rx again
        deliverer = bm.getNextBindingForDelivery()
        self.assertEqual(mk_server_cnxn_rx2, deliverer)