@classmethod
    @postonly
    @multiplayer_service
    @jsonify
    def heartbeat(cls):
        remote_addr = get_remote_addr(request)
        try:
            params = request.params
            host = params.get('host', remote_addr)
            num_players = params.get('numplayers')
            hmac = params['hmac']
        except KeyError:
            response.status_int = 400
            return {'ok': False, 'msg': 'Missing server information.'}

        calculated_hmac = _calculate_heartbeat_hmac(cls.secret, remote_addr, num_players, None)
        if hmac != calculated_hmac:
            response.status_int = 400
            return {'ok': False, 'msg': 'Invalid server information.'}

        try:
            server = cls.servers[host]
        except __HOLE__:
            response.status_int = 404
            return {'ok': False, 'msg': 'Unknown server IP.'}

        try:
            server.update(request.params)
        except KeyError:
            response.status_int = 400
            return {'ok': False, 'msg': 'Missing server information.'}
        except ValueError:
            response.status_int = 400
            return {'ok': False, 'msg': 'Incorrect server information.'}

        #LOG.info('%s: %s', host, str(server))

        return {'ok': True}
dataset/ETHPy150Open turbulenz/turbulenz_local/turbulenz_local/controllers/apiv1/multiplayer.py/MultiplayerController.heartbeat