frontend

package
v0.0.0-...-0e76970 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Copyright 2016 The Web BSD Hunt Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

//////////////////////////////////////////////////////////////////////////////

TODO: High-level file comment.

Copyright 2016 The Web BSD Hunt Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

//////////////////////////////////////////////////////////////////////////////

TODO: High-level file comment.

Index

Constants

View Source
const (
	GameInstanceTimeout = 2 * time.Minute
)
View Source
const (
	KeepAliveTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func CheckJoin

func CheckJoin(request *gamerpc.JoinRequest) error

* Side effect: may modify team to meet the backend huntd protocol requirements

func DecodeGameData

func DecodeGameData(r io.Reader) (*gamerpc.GameDataRequest, error)

func DecodeInput

func DecodeInput(r io.Reader) (*gamerpc.InputRequest, error)

func DecodeJoin

func DecodeJoin(r io.Reader) (*gamerpc.JoinRequest, error)

func DecodeKeepalive

func DecodeKeepalive(r io.Reader) (*gamerpc.KeepaliveRequest, error)

func DecodeMessage

func DecodeMessage(r io.Reader) (*gamerpc.MessageRequest, error)

func DecodePing

func DecodePing(r io.Reader) (*gamerpc.PingRequest, error)

func DecodeQuit

func DecodeQuit(r io.Reader) (*gamerpc.QuitRequest, error)

func FindGameInstance

func FindGameInstance(r *http.Request, urlstr string) (*gamerpc.GameClient, error)

func NewGameHandler

func NewGameHandler(handler func(game *gamerpc.GameClient, w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request)

func ReapGameInstances

func ReapGameInstances(r *http.Request) (int, error)

Deletes all instances found in the database that aren't in memcache. This technique is used because memcache is setup to expire the instances if not heard from for too long.

func UpdateGameInstance

func UpdateGameInstance(r *http.Request, instance string, urlstr string) (*gamerpc.GameClient, error)

Types

type AllStatsReply

type AllStatsReply struct {
	AllStats []*InstanceStatsReply
}

type DatastoreGameInfo

type DatastoreGameInfo struct {
	URL string
}

TODO(tad): this is here because Datastore can't handle the types in a gamerpc.GameClient. Ugh.

type GameInstance

type GameInstance struct {
	InstanceID string
	URL        string
}

func GameInstances

func GameInstances(r *http.Request) ([]*GameInstance, error)

type InstanceStatsReply

type InstanceStatsReply struct {
	InstanceID string
	Stats      string
}

type InstancesReply

type InstancesReply struct {
	InstanceIDs []string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL