MCPcopy
hub / github.com/aio-libs/aiohttp / connect

Method connect

examples/wssrv.py:255–273  ·  view source on GitHub ↗
(self, pid, up_write, down_read)

Source from the content-addressed store, hash-verified

253
254 @asyncio.coroutine
255 def connect(self, pid, up_write, down_read):
256 # setup pipes
257 read_transport, proto = yield from self.loop.connect_read_pipe(
258 aiohttp.StreamProtocol, os.fdopen(down_read, 'rb'))
259 write_transport, _ = yield from self.loop.connect_write_pipe(
260 aiohttp.StreamProtocol, os.fdopen(up_write, 'wb'))
261
262 # websocket protocol
263 reader = proto.reader.set_parser(websocket.WebSocketParser)
264 writer = websocket.WebSocketWriter(write_transport)
265
266 # store info
267 self.pid = pid
268 self.ping = time.monotonic()
269 self.writer = writer
270 self.rtransport = read_transport
271 self.wtransport = write_transport
272 self.chat_task = asyncio.async(self.chat(reader))
273 self.heartbeat_task = asyncio.async(self.heartbeat(writer))
274
275 def kill(self):
276 self._started = False

Callers 7

startMethod · 0.95
fMethod · 0.45
test_connectMethod · 0.45
test_authMethod · 0.45
test_auth_from_urlMethod · 0.45

Calls 3

chatMethod · 0.95
heartbeatMethod · 0.95
set_parserMethod · 0.80

Tested by 6

fMethod · 0.36
test_connectMethod · 0.36
test_authMethod · 0.36
test_auth_from_urlMethod · 0.36