src/eric7/RemoteServer/EricServerDebuggerRequestHandler.py

branch
server
changeset 10610
bb0149571d94
parent 10597
fbe93720ee9f
child 10630
552a790fd9bc
equal deleted inserted replaced
10605:b6f5e27daeb5 10610:bb0149571d94
53 connections. 53 connections.
54 """ 54 """
55 # listen on the debug server socket 55 # listen on the debug server socket
56 self.__socket.listen() 56 self.__socket.listen()
57 self.__socket.setblocking(False) 57 self.__socket.setblocking(False)
58 print( 58 print( # noqa: M801
59 f"Listening for 'debug client' connections on" 59 f"Listening for 'debug client' connections on"
60 f" {self.__socket.getsockname()}" 60 f" {self.__socket.getsockname()}"
61 ) 61 )
62 data = types.SimpleNamespace( 62 data = types.SimpleNamespace(
63 name="server", acceptHandler=self.__acceptDbgClientConnection 63 name="server", acceptHandler=self.__acceptDbgClientConnection
105 @param sock reference to the listening socket 105 @param sock reference to the listening socket
106 @type socket.socket 106 @type socket.socket
107 """ 107 """
108 connection, address = sock.accept() # Should be ready to read 108 connection, address = sock.accept() # Should be ready to read
109 print(f"'Debug client' connection from {address[0]}, port {address[1]}") 109 print(f"'Debug client' connection from {address[0]}, port {address[1]}")
110 # noqa: M801
110 connection.setblocking(False) 111 connection.setblocking(False)
111 self.__pendingConnections.append(connection) 112 self.__pendingConnections.append(connection)
112 113
113 data = types.SimpleNamespace( 114 data = types.SimpleNamespace(
114 name="debug_client", 115 name="debug_client",
148 # add an indicator for the eric-ide server 149 # add an indicator for the eric-ide server
149 data["params"]["platform"] += " (eric-ide Server)" 150 data["params"]["platform"] += " (eric-ide Server)"
150 151
151 # 2. pass on the data to the eric-ide 152 # 2. pass on the data to the eric-ide
152 jsonStr = json.dumps(data) 153 jsonStr = json.dumps(data)
153 print("Client Response:", jsonStr) 154 # - print("Client Response:", jsonStr)
154 self.__server.sendJson( 155 self.__server.sendJson(
155 category=EricRequestCategory.Debugger, 156 category=EricRequestCategory.Debugger,
156 reply="DebugClientResponse", 157 reply="DebugClientResponse",
157 params={"response": jsonStr}, 158 params={"response": jsonStr},
158 ) 159 )
314 @param params dictionary containing the request data 315 @param params dictionary containing the request data
315 @type dict 316 @type dict
316 """ 317 """
317 debuggerId = params["debugger_id"] 318 debuggerId = params["debugger_id"]
318 jsonStr = params["command"] 319 jsonStr = params["command"]
319 print(debuggerId, "->", jsonStr)
320 320
321 if not debuggerId and self.__mainClientId and "RequestBanner" in jsonStr: 321 if not debuggerId and self.__mainClientId and "RequestBanner" in jsonStr:
322 # modify the target for the 'RequestBanner' request 322 # modify the target for the 'RequestBanner' request
323 debuggerId = self.__mainClientId 323 debuggerId = self.__mainClientId
324 324
330 try: 330 try:
331 sock = self.__connections[debuggerId] 331 sock = self.__connections[debuggerId]
332 self.__server.sendJsonCommand(jsonStr, sock) 332 self.__server.sendJsonCommand(jsonStr, sock)
333 except KeyError: 333 except KeyError:
334 print(f"Command for unknown debugger ID '{debuggerId}' received.") 334 print(f"Command for unknown debugger ID '{debuggerId}' received.")
335 # noqa: M801

eric ide

mercurial