MCPcopy
hub / github.com/apache/caldera / accept

Method accept

app/contacts/contact_tcp.py:70–81  ·  view source on GitHub ↗
(self, reader, writer)

Source from the content-addressed store, hash-verified

68 index += 1
69
70 async def accept(self, reader, writer):
71 try:
72 profile = await self._handshake(reader)
73 except Exception as e:
74 self.log.debug('Handshake failed: %s' % e)
75 return
76 profile['executors'] = [e for e in profile['executors'].split(',') if e]
77 profile['contact'] = 'tcp'
78 agent, _ = await self.services.get('contact_svc').handle_heartbeat(**profile)
79 new_session = Session(id=self.generate_number(size=6), paw=agent.paw, reader=reader, writer=writer)
80 self.sessions.append(new_session)
81 await self.send(new_session.id, agent.paw, timeout=5)
82
83 async def send(self, session_id: int, cmd: str, timeout: int = 60) -> Tuple[int, str, str, str]:
84 try:

Callers

nothing calls this directly

Calls 4

_handshakeMethod · 0.95
sendMethod · 0.95
generate_numberMethod · 0.80
handle_heartbeatMethod · 0.45

Tested by

no test coverage detected