Ejemplo n.º 1
0
func NewCoreWorkerManager(option options.SysOption, stat *statistic.Statistic) *CoreWorkerManager {
	// setup statistic items
	stat.AddItem("processed", "Processed messages count")
	stat.AddItem("skip_cmd", "Command with skip instruction count")
	manager := CoreWorkerManager{
		OutSignalChannel:        make(chan bool, 1),
		workerStopSignalChannel: make(chan bool, option.Workers),
		instructionsChannel:     make(chan coreprocessing.CoreInstruction, option.BufferSize),
		outChannels:             make([]*outChannelGroup, connectionsupport.GroupCount),
		methodsDict:             coreprocessing.NewMethodInstructionDict(),
		statistic:               stat,
		options:                 option}
	return &manager
}
Ejemplo n.º 2
0
func NewServer(option options.SysOption, stat *statistic.Statistic) *ConnectionServer {
	stat.AddItem("connection_count", "Client conntection count")
	stat.AddItem("income_data_size", "Income data size")
	stat.AddItem("outcome_data_size", "Outcome data size")
	stat.AddItem("bad_command_count", "Format error command count")
	stat.AddItem("lost_connection_count", "Lost connection count")
	stat.AddItem("auth_request", "Request for auth count")
	stat.AddItem("auth_successfull", "Successfully auth request count")
	stat.AddItem("count_connection_client", "Connection count (service clients)")
	stat.AddItem("count_connection_server", "Connection count (servers)")
	stat.AddItem("count_connection_web", "Connection count (web-socket)")
	//
	server := ConnectionServer{
		statusAcceptedObject: statusAcceptedObject{
			statusChangeLock: new(sync.RWMutex)},
		option: option,
		stat:   stat}
	return &server
}