def HandleClient(self, sock, permissions):
    # Use a long timeout here.
    sock.settimeout(self.CLIENT_TIMEOUT_TIME)
    cmdlen_str = self._ReadExactlyFailAfterFirst(sock, sutils.SIZE_PACKER.size)
    if not cmdlen_str:
      return ""
    cmdlen = sutils.SIZE_PACKER.unpack(cmdlen_str)[0]
    # Full request must be here.
    sock.settimeout(self.READ_TIMEOUT)
    try:
      cmd_str = self._ReadExactly(sock, cmdlen)
    except (socket.timeout, socket.error):
      return ""
    cmd = rdf_data_server.DataStoreCommand(cmd_str)

    request = cmd.request
    op = cmd.command

    cmdinfo = self.CMDTABLE.get(op)
    if not cmdinfo:
      logging.error("Unrecognized command %d", op)
      return ""
    method, perm = cmdinfo
    if perm in permissions:
      response = method(request)
    else:
      status_desc = ("Operation not allowed: required %s but only have "
                     "%s permissions" % (perm, permissions))
      resp = rdf_data_store.DataStoreResponse(
          request=cmd.request, status_desc=status_desc,
          status=rdf_data_store.DataStoreResponse.Status.AUTHORIZATION_DENIED)
      response = resp.SerializeToString()

    return sutils.SIZE_PACKER.pack(len(response)) + response
Explicitly zero out unused elements of a real symmetric banded matrix.
dataset/ETHPy150Open google/grr/grr/server/data_server/data_server.py/DataServerHandler.HandleClient--crossover with--dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/sandbox/bspline.py/_zero_triband