Skip to content

server

Constants #

const ticks_per_second = 20
const day_length_ticks = 24000
const worlds_dir = 'worlds'
const crashdumps_dir = 'crashdumps'

fn new #

fn new(cfg conf.Config) &Server

struct Server #

struct Server {
mut:
	listener &raknet.Listener = unsafe { nil }
	hub      &session.Hub     = unsafe { nil }
	guid     i64
	plugins  &plugin.Manager            = unsafe { nil }
	running  &stdatomic.AtomicVal[bool] = stdatomic.new_atomic[bool](false)
	// active_conns bounds concurrent connection handlers so a flood of
	// half-open/pre-login peers can't exhaust threads and CPU.
	active_conns &stdatomic.AtomicVal[u64] = stdatomic.new_atomic[u64](0)
	created_at   time.Time
pub mut:
	log  &logger.Logger
	lang &language.Lang
	cfg  conf.Config
}

fn (Server) start #

fn (mut s Server) start() !

fn (Server) stop #

fn (mut s Server) stop()