Signed-off-by: Yuichi Ito <[email protected]>
---
 ryu/lib/packet/sctp.py |   28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/ryu/lib/packet/sctp.py b/ryu/lib/packet/sctp.py
index e491c37..8c1a20b 100644
--- a/ryu/lib/packet/sctp.py
+++ b/ryu/lib/packet/sctp.py
@@ -1133,9 +1133,12 @@ class cause(stringify.StringifyMixin):
     def parser(cls, buf):
         pass

-    @abc.abstractmethod
     def serialize(self):
-        pass
+        if 0 == self.length:
+            self.length = self._MIN_LEN
+        buf = struct.pack(
+            self._PACK_STR, self.cause_code(), self.length)
+        return buf

     def __len__(self):
         length = self.length
@@ -1350,13 +1353,6 @@ class cause_out_of_resource(cause):
         (_, length) = struct.unpack_from(cls._PACK_STR, buf)
         return cls(length)

-    def serialize(self):
-        if 0 == self.length:
-            self.length = self._MIN_LEN
-        buf = struct.pack(
-            self._PACK_STR, self.cause_code(), self.length)
-        return buf
-

 @chunk_abort.register_cause_code
 @chunk_error.register_cause_code
@@ -1483,13 +1479,6 @@ class cause_invalid_param(cause):
         (_, length) = struct.unpack_from(cls._PACK_STR, buf)
         return cls(length)

-    def serialize(self):
-        if 0 == self.length:
-            self.length = self._MIN_LEN
-        buf = struct.pack(
-            self._PACK_STR, self.cause_code(), self.length)
-        return buf
-

 @chunk_abort.register_cause_code
 @chunk_error.register_cause_code
@@ -1583,13 +1572,6 @@ class cause_cookie_while_shutdown(cause):
         (_, length) = struct.unpack_from(cls._PACK_STR, buf)
         return cls(length)

-    def serialize(self):
-        if 0 == self.length:
-            self.length = self._MIN_LEN
-        buf = struct.pack(
-            self._PACK_STR, self.cause_code(), self.length)
-        return buf
-

 @chunk_abort.register_cause_code
 @chunk_error.register_cause_code
-- 
1.7.10.4


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to