friends/globals/globals.go
Daniel López Guimaraes 120776e197
fix: Better initialization of NEX server accounts
Initializing the server accounts in their own thread (e.g. the
authentication and secure servers) can cause a race condition where the
secure account hasn't been set up yet when authentication configures
`ticket-granting`, causing sometimes crashes on startup.

This has happened on production causing unnecesary restarts. To fix
this, initialize the accounts on the `init` function to ensure they will
always be accessible when needed.
2024-10-29 23:01:59 +00:00

26 lines
861 B
Go

package globals
import (
"github.com/PretendoNetwork/friends/types"
pb "github.com/PretendoNetwork/grpc-go/account"
"github.com/PretendoNetwork/nex-go/v2"
"github.com/PretendoNetwork/plogger-go"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
)
var Logger *plogger.Logger
var AuthenticationServerAccount *nex.Account
var SecureServerAccount *nex.Account
var GuestAccount *nex.Account
var KerberosPassword = "password" // * Default password
var AuthenticationServer *nex.PRUDPServer
var AuthenticationEndpoint *nex.PRUDPEndPoint
var SecureServer *nex.PRUDPServer
var SecureEndpoint *nex.PRUDPEndPoint
var ConnectedUsers *nex.MutexMap[uint32, *types.ConnectedUser]
var AESKey []byte
var GRPCAccountClientConnection *grpc.ClientConn
var GRPCAccountClient pb.AccountClient
var GRPCAccountCommonMetadata metadata.MD
var DatabaseMaxConnections int