Skip to content

Commit 23bb159

Browse files
author
Kirill Kirsanov
committed
MTS fixes
1 parent 86b9a28 commit 23bb159

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ def read_pdu(self):
283283
logger.debug('<<%s (%d bytes)', binascii.b2a_hex(raw_pdu), len(raw_pdu))
284284

285285
p = smpp.parse_pdu(raw_pdu, client=self)
286-
287286
logger.debug('Read %s PDU', p.command)
288287
p.data = dict()
289288

@@ -336,7 +335,6 @@ def message_sent_handler(pdu, **kwargs):
336335

337336
def listen(self, ignore_error_codes=None):
338337
"""Listen for PDUs and act"""
339-
340338
while True:
341339
try:
342340
self.SendMessages()

pdu.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,20 +250,21 @@ def get_status_desc(self, status=None):
250250
def parse(self, data):
251251

252252
"""Parse raw PDU"""
253+
253254
header = data[0:16]
254255
chunks = struct.unpack('>LLLL', header)
255-
256256
self.length = chunks[0]
257257
self.command = extract_command(data)
258-
259258
self.status = chunks[2]
260259
self.sequence = chunks[3]
261-
if len(data) > 16: # kir
260+
261+
if len(data) > 30:
262262
try:
263263
pdp = PDUParser(data, 'bin')
264264
self.parsed = pdp.parse()
265265
return self.parsed
266266
except Exception as e:
267+
print()
267268
print(e)
268269

269270
def _unpack(self, fmt, data):

smpp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def parse_pdu(data, **kwargs):
3838
"""Parse binary PDU"""
3939

4040
command = pdu.extract_command(data)
41-
4241
if command is None:
4342
return None
4443
new_pdu = make_pdu(command, **kwargs)
4544
new_pdu.parse(data)
45+
4646
return new_pdu

0 commit comments

Comments
 (0)