def connected(self, client):
        """Call this method when a client connected."""
        self.clients.add(client)
        self._log_connected(client)
        self._start_watching(client)
        self.send_msg(client, WELCOME, (self.pickle_protocol, __version__),
                      pickle_protocol=0)
        profiler = self.profiler
        while True:
            try:
                profiler = profiler.profiler
            except AttributeError:
                break
        self.send_msg(client, PROFILER, type(profiler))
        if self._latest_result_data is not None:
            try:
                self._send(client, self._latest_result_data)
            except socket.error as exc:
                if exc.errno in (EBADF, EPIPE):
                    self.disconnected(client)
                    return
                raise
        if len(self.clients) == 1:
            self._start_profiling()
Call this method when a client connected.