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

Method handle

Lib/logging/config.py:965–1002  ·  view source on GitHub ↗

Handle a request. Each request is expected to be a 4-byte length, packed using struct.pack(">L", n), followed by the config file. Uses fileConfig() to do the grunt work.

(self)

Source from the content-addressed store, hash-verified

963 to install it.
964 """
965 def handle(self):
966 """
967 Handle a request.
968
969 Each request is expected to be a 4-byte length, packed using
970 struct.pack(">L", n), followed by the config file.
971 Uses fileConfig() to do the grunt work.
972 """
973 try:
974 conn = self.connection
975 chunk = conn.recv(4)
976 if len(chunk) == 4:
977 slen = struct.unpack(">L", chunk)[0]
978 chunk = self.connection.recv(slen)
979 while len(chunk) < slen:
980 chunk = chunk + conn.recv(slen - len(chunk))
981 if self.server.verify is not None:
982 chunk = self.server.verify(chunk)
983 if chunk is not None: # verified, can process
984 chunk = chunk.decode("utf-8")
985 try:
986 import json
987 d =json.loads(chunk)
988 assert isinstance(d, dict)
989 dictConfig(d)
990 except Exception:
991 #Apply new configuration.
992
993 file = io.StringIO(chunk)
994 try:
995 fileConfig(file)
996 except Exception:
997 traceback.print_exc()
998 if self.server.ready:
999 self.server.ready.set()
1000 except OSError as e:
1001 if e.errno != RESET_ERROR:
1002 raise
1003
1004 class ConfigSocketReceiver(ThreadingTCPServer):
1005 """

Callers

nothing calls this directly

Calls 11

lenFunction · 0.85
isinstanceFunction · 0.85
dictConfigFunction · 0.85
fileConfigFunction · 0.85
print_excMethod · 0.80
recvMethod · 0.45
unpackMethod · 0.45
verifyMethod · 0.45
decodeMethod · 0.45
loadsMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected