Skip to content

Commit

Permalink
clean out remaining use of smpp_offset and smpp_increment
Browse files Browse the repository at this point in the history
this should conclude issue-90
  • Loading branch information
dmaclay committed Jan 24, 2012
1 parent de6755e commit 394fb57
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 47 deletions.
2 changes: 0 additions & 2 deletions config/example_smpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ system_id: smppclient1 # username
password: password # password
host: localhost # the host to connect to
port: 2775 # the port to connect to
smpp_offset: 1
smpp_increment: 1
4 changes: 0 additions & 4 deletions etc/supervisord.production.conf
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ command=twistd -n
--worker_class=vumi.workers.smpp.transport.SmppTransport
--vhost=/production
--config=./config/smpp_clickatell_production.yaml
--set-option=smpp_offset:%(process_num)s
--set-option=smpp_increment:10
environment=DJANGO_SETTINGS_MODULE=environments.production
stdout_logfile=./logs/%(program_name)s_%(process_num)s.log
stdout_logfile_maxbytes=10MB
Expand Down Expand Up @@ -220,8 +218,6 @@ command=twistd -n
--worker_class=vumi.workers.irc.transport.IrcTransport
--vhost=/production
--config=./config/irc.yaml
--set-option=smpp_offset:%(process_num)s
--set-option=smpp_increment:10
environment=DJANGO_SETTINGS_MODULE=environments.production
stdout_logfile=./logs/%(program_name)s_%(process_num)s.log
stdout_logfile_maxbytes=10MB
Expand Down
11 changes: 0 additions & 11 deletions vumi/transports/smpp/clientserver/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ def __init__(self, config, kvs):
self.state = 'CLOSED'
log.msg('STATE: %s' % (self.state))
self.config = config
self.inc = int(self.config['smpp_increment'])
self.smpp_bind_timeout = int(self.config.get('smpp_bind_timeout', 30))
self.datastream = ''
self.__connect_callback = None
Expand Down Expand Up @@ -373,9 +372,6 @@ def getNextSeq(self):
else:
return seq

# TODO From VUMI 0.4 onwards incSeq and smpp_offset/smpp_increment
# will fall away and getSeq will run off the Redis incr function
# with one shared value per system_id@host:port account credential
def incSeq(self):
self.getNextSeq()

Expand Down Expand Up @@ -680,13 +676,6 @@ class EsmeTransceiverFactory(ReconnectingClientFactory):
def __init__(self, config, kvs):
self.config = config
self.kvs = kvs
if int(self.config['smpp_increment']) \
< int(self.config['smpp_offset']):
raise Exception("increment may not be less than offset")
if int(self.config['smpp_increment']) < 1:
raise Exception("increment may not be less than 1")
if int(self.config['smpp_offset']) < 0:
raise Exception("offset may not be less than 0")
self.esme = None
self.__connect_callback = None
self.__disconnect_callback = None
Expand Down
3 changes: 0 additions & 3 deletions vumi/transports/smpp/clientserver/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ def loseConnection(self):
class FakeEsmeTransceiver(EsmeTransceiver):
def __init__(self):
self.defaults = {}
self.name = 'test_esme'
self.inc = 1
self.seq = [0]
self.smpp_bind_timeout = 10
self.clock = Clock()
self.callLater = self.clock.callLater
Expand Down
2 changes: 0 additions & 2 deletions vumi/transports/smpp/tests/test_smpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ def setUp(self):
"system_id": "vumitest-vumitest-vumitest",
"host": "host",
"port": "port",
"smpp_increment": 10,
"smpp_offset": 6,
"TRANSPORT_NAME": "redis_testing_transport",
}
self.vumi_options = {
Expand Down
25 changes: 0 additions & 25 deletions vumi/transports/smpp/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@ class SmppTransport(Transport):
The SMPP transport has many configuration parameters. These are
divided up into sections below.
SMPP sequence number configuration options:
:type smpp_increment: int
:param smpp_increment:
Increment for SMPP sequence number (must be >= number of
SMPP workers on a single SMPP account).
:type smpp_offset: int
:param smpp_offset:
Offset for this worker's SMPP sequence numbers (no duplicates
on a single SMPP account and must be <= increment)
SMPP server account configuration options:
:type system_id: str
Expand Down Expand Up @@ -104,7 +93,6 @@ def setup_transport(self):

# TODO: move this to a config file
dbindex = get_deploy_int(self._amqp_client.vhost)
self.smpp_offset = int(self.config['smpp_offset'])

# Connect to Redis
if not hasattr(self, 'r_server'):
Expand All @@ -113,9 +101,6 @@ def setup_transport(self):
self.r_prefix = "%(system_id)s@%(host)s:%(port)s" % self.config
self.r_message_prefix = "%s#message_json" % self.r_prefix
log.msg("Connected to Redis, prefix: %s" % self.r_prefix)
last_sequence_number = int(self.r_get_last_sequence()
or self.smpp_offset)
log.msg("Last sequence_number: %s" % last_sequence_number)

if not hasattr(self, 'esme_client'):
# start the Smpp transport (if we don't have one)
Expand Down Expand Up @@ -152,7 +137,6 @@ def handle_outbound_message(self, message):
#self.conn_throttle(unacked=self.esme_client.get_unacked_count())
self.r_set_message(message)
sequence_number = self.send_smpp(message)
self.r_set_last_sequence(sequence_number)
self.r_set_id_for_sequence(sequence_number,
message.payload.get("message_id"))

Expand Down Expand Up @@ -197,15 +181,6 @@ def r_delete_for_sequence(self, sequence_number):
def r_set_id_for_sequence(self, sequence_number, id):
self.r_server.set(self.r_sequence_number_key(sequence_number), id)

def r_last_sequence_number_key(self):
return "%s_%s#last_sequence_number" % (self.r_prefix, self.smpp_offset)

def r_get_last_sequence(self):
return self.r_server.get(self.r_last_sequence_number_key())

def r_set_last_sequence(self, sequence_number):
self.r_server.set(self.r_last_sequence_number_key(), sequence_number)

def submit_sm_resp(self, *args, **kwargs): # TODO the client does too much
transport_msg_id = kwargs['message_id']
sent_sms_id = self.r_get_id_for_sequence(kwargs['sequence_number'])
Expand Down

0 comments on commit 394fb57

Please sign in to comment.