MCPcopy Index your code
hub / github.com/python/cpython / checkHopLimitTruncatedHeader

Method checkHopLimitTruncatedHeader

Lib/test/test_socket.py:4630–4648  ·  view source on GitHub ↗
(self, ancbufsize, ignoreflags=0)

Source from the content-addressed store, hash-verified

4628 # Tests for proper handling of truncated ancillary data
4629
4630 def checkHopLimitTruncatedHeader(self, ancbufsize, ignoreflags=0):
4631 # Receive hop limit into ancbufsize bytes of ancillary data
4632 # space, which should be too small to contain the ancillary
4633 # data header (if ancbufsize is None, pass no second argument
4634 # to recvmsg()). Check that data is MSG, MSG_CTRUNC is set
4635 # (unless included in ignoreflags), and no ancillary data is
4636 # returned.
4637 self.serv_sock.setsockopt(socket.IPPROTO_IPV6,
4638 socket.IPV6_RECVHOPLIMIT, 1)
4639 self.misc_event.set()
4640 args = () if ancbufsize is None else (ancbufsize,)
4641 msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock,
4642 len(MSG), *args)
4643
4644 self.assertEqual(msg, MSG)
4645 self.checkRecvmsgAddress(addr, self.cli_addr)
4646 self.assertEqual(ancdata, [])
4647 self.checkFlags(flags, eor=True, checkset=socket.MSG_CTRUNC,
4648 ignore=ignoreflags)
4649
4650 @requireAttrs(socket, "IPV6_RECVHOPLIMIT", "IPV6_HOPLIMIT")
4651 def testCmsgTruncNoBufSize(self):

Callers 5

testSingleCmsgTrunc0Method · 0.95
testSingleCmsgTrunc1Method · 0.95

Calls 6

checkFlagsMethod · 0.80
setsockoptMethod · 0.45
setMethod · 0.45
doRecvmsgMethod · 0.45
assertEqualMethod · 0.45
checkRecvmsgAddressMethod · 0.45

Tested by

no test coverage detected