Skip to content

Commit 48fc7cf

Browse files
committed
update properties declaration to match code conventions
1 parent f889c6f commit 48fc7cf

File tree

1 file changed

+33
-35
lines changed

1 file changed

+33
-35
lines changed

sctp.py

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ class sctpsocket(object):
10051005
associations, in seconds. A value of 0 means that no automatic close
10061006
will be done. This property does not work for TCP-style sockets.
10071007
1008-
timetolive: Default TTL value to use with sctp_send. Default set to 0.
1008+
ttl: Default timetolive value to use with sctp_send. Default set to 0.
10091009
10101010
streamid: Default SCTP stream identifier value to use with sctp_send. Default set to 0.
10111011
@@ -1042,40 +1042,6 @@ def __init__(self, family, style, sk):
10421042

10431043
self.datalogging = False
10441044

1045-
@property
1046-
def ttl(self):
1047-
"""
1048-
Read default time to live value, 0 mean infinite
1049-
"""
1050-
return self._ttl
1051-
1052-
@ttl.setter
1053-
def ttl(self, newVal):
1054-
"""
1055-
Write default time to live
1056-
"""
1057-
if not isinstance(newVal, int) or newVal < 0 or newVal > 255:
1058-
raise ValueError('TTL shall be >= 0 and <= 255')
1059-
1060-
self._ttl = newVal
1061-
1062-
@property
1063-
def streamid(self):
1064-
"""
1065-
Read default stream identifier
1066-
"""
1067-
return self._streamid
1068-
1069-
@streamid.setter
1070-
def streamid(self, newVal):
1071-
"""
1072-
Write default stream identifier
1073-
"""
1074-
if not isinstance(newVal, int) or newVal < 0 or newVal > 65535:
1075-
raise ValueError('streamid shall be a valid unsigned 16bits integer')
1076-
1077-
self._streamid = newVal
1078-
10791045
def bindx(self, sockaddrs, action=BINDX_ADD):
10801046
"""
10811047
Binds to a list of addresses. This method() allows to bind to any subset
@@ -1672,6 +1638,36 @@ def set_rtoinfo(self, o):
16721638
"""
16731639
_sctp.set_rtoinfo(self._sk.fileno(), o.__dict__)
16741640

1641+
def get_ttl(self):
1642+
"""
1643+
Read default time to live value, 0 mean infinite
1644+
"""
1645+
return self._ttl
1646+
1647+
def set_ttl(self, newVal):
1648+
"""
1649+
Write default time to live
1650+
"""
1651+
if not isinstance(newVal, int) or newVal < 0 or newVal > 255:
1652+
raise ValueError('TTL shall be >= 0 and <= 255')
1653+
1654+
self._ttl = newVal
1655+
1656+
def get_streamid(self):
1657+
"""
1658+
Read default stream identifier
1659+
"""
1660+
return self._streamid
1661+
1662+
def set_streamid(self, newVal):
1663+
"""
1664+
Write default stream identifier
1665+
"""
1666+
if not isinstance(newVal, int) or newVal < 0 or newVal > 65535:
1667+
raise ValueError('streamid shall be a valid unsigned 16bits integer')
1668+
1669+
self._streamid = newVal
1670+
16751671
# delegation
16761672

16771673
def sock(self):
@@ -1696,6 +1692,8 @@ def __getattr__(self, name):
16961692
mappedv4 = property(get_mappedv4, set_mappedv4)
16971693
maxseg = property(get_maxseg, set_maxseg)
16981694
autoclose = property(get_autoclose, set_autoclose)
1695+
ttl = property(get_ttl, set_ttl)
1696+
streamid = property(get_streamid, set_streamid)
16991697

17001698
class sctpsocket_tcp(sctpsocket):
17011699
"""

0 commit comments

Comments
 (0)