def handle(self):
        lock_socket_list.acquire()
        socket_list[self.client_address] = self.request
        lock_socket_list.release()

        HP.logger.debug('Got connection from %s' % self.client_address[0])
        while True:
            msg = HP.recv_hm_message(socket_list[self.client_address])
            if not msg:
                continue
            if msg.message != HM.ACK:

                # If we do receive a STARTING message, let's record the starting time
                # No need to continue processing the packet, we can wait the next one
                if msg.action == HM.STARTING:
                    start_time(self.client_address)
                    continue

                if msg.message == HM.DISCONNECT:
                    HP.logger.debug('Disconnecting from %s' %
                                    self.client_address[0])

                    lock_host.acquire()
                    del hosts[self.client_address]
                    del hosts_state[self.client_address]
                    lock_host.release()

                    socket_list[self.client_address].close()

                    lock_socket_list.acquire()
                    del socket_list[self.client_address]
                    lock_socket_list.release()
                    return
                else:
                    lock_host.acquire()
                    hosts[self.client_address] = msg
                    hosts_state[self.client_address] = NOTHING_RUN
                    lock_host.release()

                    if msg.message == HM.MODULE and msg.action == HM.COMPLETED:
                        if running_jitter is True:
                            stop_time(self.client_address)

                        if msg.module == HM.CPU:
                            cpu_completed(self.client_address, msg)
                        elif msg.module == HM.MEMORY:
                            memory_completed(self.client_address, msg)
                        elif msg.module == HM.NETWORK:
                            network_completed(self.client_address, msg)
                        elif msg.module == HM.STORAGE:
                            storage_completed(self.client_address, msg)
dataset/ETHPy150Open redhat-cip/edeploy/src/health-server.py/SocketHandler.handle/original