MCPcopy Create free account
hub / github.com/ElementsProject/lightning / serve

Function serve

tests/test_connection.py:5128–5149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5126 proxyport = listener.getsockname()[1]
5127
5128 def serve():
5129 data = b''
5130 conn, _ = listener.accept()
5131 with conn:
5132 try:
5133 conn.settimeout(TIMEOUT)
5134 conn.recv(len(b'\x05\x01\x00'))
5135 conn.sendall(b'\x05\x00')
5136 # Deliberately ask for far more than the largest legal
5137 # request (262 bytes), so an oversized write is visible
5138 # here rather than silently truncated by us. We stop on the
5139 # timeout, once connectd has finished writing and is waiting
5140 # for a reply we're never going to send.
5141 conn.settimeout(2)
5142 while len(data) < 65536:
5143 more = conn.recv(65536)
5144 if not more:
5145 break
5146 data += more
5147 except OSError:
5148 pass
5149 received.append(data)
5150
5151 server = threading.Thread(target=serve, daemon=True)
5152 server.start()

Callers

nothing calls this directly

Calls 3

acceptMethod · 0.80
sendallMethod · 0.80
recvMethod · 0.45

Tested by

no test coverage detected