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

Method sendfile

Lib/ssl.py:1308–1327  ·  view source on GitHub ↗

Send a file, possibly by using an efficient sendfile() call if the system supports it. Return the total number of bytes sent.

(self, file, offset=0, count=None)

Source from the content-addressed store, hash-verified

1306 return super().sendall(data, flags)
1307
1308 def sendfile(self, file, offset=0, count=None):
1309 """Send a file, possibly by using an efficient sendfile() call if
1310 the system supports it. Return the total number of bytes sent.
1311 """
1312 if self._sslobj is None:
1313 return super().sendfile(file, offset, count)
1314
1315 if not self._sslobj.uses_ktls_for_send():
1316 return self._sendfile_use_send(file, offset, count)
1317
1318 sendfile = getattr(self._sslobj, "sendfile", None)
1319 if sendfile is None:
1320 return self._sendfile_use_send(file, offset, count)
1321
1322 try:
1323 return self._sendfile_zerocopy(
1324 sendfile, _GiveupOnSSLSendfile, file, offset, count,
1325 )
1326 except _GiveupOnSSLSendfile:
1327 return self._sendfile_use_send(file, offset, count)
1328
1329 def recv(self, buflen=1024, flags=0):
1330 self._checkClosed()

Callers 1

_fastcopy_sendfileFunction · 0.45

Calls 3

superClass · 0.85
_sendfile_use_sendMethod · 0.80
_sendfile_zerocopyMethod · 0.80

Tested by

no test coverage detected