File tree Expand file tree Collapse file tree 3 files changed +5
-6
lines changed Expand file tree Collapse file tree 3 files changed +5
-6
lines changed Original file line number Diff line number Diff 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 ()
Original file line number Diff line number Diff 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 ):
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments