Change in python/osmo-python-tests[master]: ctrl: add function to skip TRAP messages

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Nov 27 11:24:45 UTC 2018


Pau Espin Pedrol has posted comments on this change. ( https://gerrit.osmocom.org/11929 )

Change subject: ctrl: add function to skip TRAP messages
......................................................................


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/11929/2/osmopy/osmo_ipa.py
File osmopy/osmo_ipa.py:

https://gerrit.osmocom.org/#/c/11929/2/osmopy/osmo_ipa.py@126
PS2, Line 126:         if (int(length) != 0):
> > if length == 0 or payload... […]
Well, that depends whether you want to return an IPA message with empty IPA payload ("return head"), or just skip it and continue looking for a CTRL message with some content (probably what you want, "return self.skip_traps(tail)").

Otherwise if you'd receive an IPA message with len(payload) == 0 followed by an IPA message containing a CTRL message, it would be lost because you return None instead of head.


    def skip_traps(self, data):
        """
        Take one or more ctrl messages and data and return first non-TRAP message or None
        """
        if data == None or len(data) == 0:
            return None

        (head, tail) = self.split_combined(data)
        (length, _, _, payload) = self.del_header(head)
        if length == 0 or payload[:(length + 3)].decode('utf-8').startswith(self.CTRL_TRAP):
                return self.skip_traps(tail)
        else:
                return head



-- 
To view, visit https://gerrit.osmocom.org/11929
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I51ce207c19a1ca96c3e2af7d5efd64f79b02fbb4
Gerrit-Change-Number: 11929
Gerrit-PatchSet: 2
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Comment-Date: Tue, 27 Nov 2018 11:24:45 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181127/5847deff/attachment.htm>


More information about the gerrit-log mailing list