MCPcopy Index your code
hub / github.com/RustPython/RustPython / serve_client

Method serve_client

Lib/multiprocessing/managers.py:241–320  ·  view source on GitHub ↗

Handle requests from the proxies in a particular process/thread

(self, conn)

Source from the content-addressed store, hash-verified

239 conn.close()
240
241 def serve_client(self, conn):
242 '''
243 Handle requests from the proxies in a particular process/thread
244 '''
245 util.debug('starting server thread to service %r',
246 threading.current_thread().name)
247
248 recv = conn.recv
249 send = conn.send
250 id_to_obj = self.id_to_obj
251
252 while not self.stop_event.is_set():
253
254 try:
255 methodname = obj = None
256 request = recv()
257 ident, methodname, args, kwds = request
258 try:
259 obj, exposed, gettypeid = id_to_obj[ident]
260 except KeyError as ke:
261 try:
262 obj, exposed, gettypeid = \
263 self.id_to_local_proxy_obj[ident]
264 except KeyError:
265 raise ke
266
267 if methodname not in exposed:
268 raise AttributeError(
269 'method %r of %r object is not in exposed=%r' %
270 (methodname, type(obj), exposed)
271 )
272
273 function = getattr(obj, methodname)
274
275 try:
276 res = function(*args, **kwds)
277 except Exception as e:
278 msg = ('#ERROR', e)
279 else:
280 typeid = gettypeid and gettypeid.get(methodname, None)
281 if typeid:
282 rident, rexposed = self.create(conn, typeid, res)
283 token = Token(typeid, self.address, rident)
284 msg = ('#PROXY', (rexposed, token))
285 else:
286 msg = ('#RETURN', res)
287
288 except AttributeError:
289 if methodname is None:
290 msg = ('#TRACEBACK', format_exc())
291 else:
292 try:
293 fallback_func = self.fallback_mapping[methodname]
294 result = fallback_func(
295 self, conn, ident, obj, *args, **kwds
296 )
297 msg = ('#RETURN', result)
298 except Exception:

Callers 1

accept_connectionMethod · 0.95

Calls 13

createMethod · 0.95
format_excFunction · 0.90
recvFunction · 0.85
getattrFunction · 0.85
sendFunction · 0.85
TokenClass · 0.70
functionFunction · 0.50
debugMethod · 0.45
is_setMethod · 0.45
getMethod · 0.45
exitMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected