Skip to content

Commit

Permalink
take into account the kernel doubling the value at setting
Browse files Browse the repository at this point in the history
  • Loading branch information
p1-bmu committed Oct 10, 2018
1 parent f6bc61e commit 4c6f117
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sctp.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import datetime
import time
import os
import sys

####################################### CONSTANTS

Expand Down Expand Up @@ -1106,7 +1107,8 @@ def getladdrs(self, assoc_id = 0): # -> tuple of sockaddrs as strings

return _sctp.getladdrs(self._sk.fileno(), assoc_id)

def sctp_send(self, msg, to=("",0), ppid=0, flags=0, stream=0, timetolive=0, context=0, record_file_prefix="RECORD_sctp_traffic", datalogging = False):
def sctp_send(self, msg, to=("",0), ppid=0, flags=0, stream=0, timetolive=0, context=0,
record_file_prefix="RECORD_sctp_traffic", datalogging = False):
"""
Sends a SCTP message. While send()/sendto() can also be used, this method also
accepts some SCTP-exclusive metadata. Parameters:
Expand Down Expand Up @@ -1364,12 +1366,13 @@ def get_sndbuf(self):
Gets the send buffer size from the kernel for this socket.
"""
return _sctp.get_sndbuf(self._sk.fileno())

def set_sndbuf(self, rvalue):
"""
Sets the send buffer size in the kernel for this socket.
"""
_sctp.set_sndbuf(self._sk.fileno(), rvalue)
# Linux doubles the size, hence we divise it by 2
_sctp.set_sndbuf(self._sk.fileno(), rvalue//2)

def get_disable_fragments(self):
"""
Expand Down

0 comments on commit 4c6f117

Please sign in to comment.