Exemplo n.º 1
0
// handshake performs the isaac key exchange
func (svc *GameService) handshake(client player.Player) error {
	serverSeed := client.ServerISAACSeed()

	handshake := protocol.InboundGameHandshake{}
	if err := handshake.Decode(client.Conn().ReadBuffer, nil); err != nil {
		return err
	}

	client.Conn().Write <- &protocol.OutboundGameHandshake{
		ServerISAACSeed: [2]encoding.Uint32{
			encoding.Uint32(serverSeed[0]), encoding.Uint32(serverSeed[1]),
		},
	}

	client.SetDecodeFunc(svc.decodeLoginBlock)
	return nil
}