mnet

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get_ConnectPool_Instance

func Get_ConnectPool_Instance() face.IConnection

func Get_Match_Instance

func Get_Match_Instance() face.IMatchSystem

func Get_Server_Instance

func Get_Server_Instance() face.IServer

func Get_WorkerPool_Instance

func Get_WorkerPool_Instance() face.IWorkerPool

func NewConnectionManager

func NewConnectionManager() face.IConnection

func NewMatchSystem

func NewMatchSystem() face.IMatchSystem

func NewServer

func NewServer() face.IServer

func NewSession

func NewSession(conn *kcp.UDPSession, sid uint32) face.ISession

func NewTestStruct

func NewTestStruct() face.ITest

func NewWorkerPool

func NewWorkerPool() face.IWorkerPool

func OnRoomDelete

func OnRoomDelete(room face.IRoom)

func OnRoomSpawn

func OnRoomSpawn(room face.IRoom)

func SpawnRoom

func SpawnRoom(playerSessions []face.ISession) face.IRoom

Types

type ConnectionManager

type ConnectionManager struct {
	NewSessionSid uint32
	// contains filtered or unexported fields
}

func (*ConnectionManager) AddRoom

func (connectionManager *ConnectionManager) AddRoom(room face.IRoom)

func (*ConnectionManager) AddSession

func (connectionManager *ConnectionManager) AddSession(conn *kcp.UDPSession)

func (*ConnectionManager) DeleteRoom

func (connectionManager *ConnectionManager) DeleteRoom(roomId uint32)

func (*ConnectionManager) DeleteSession

func (connectionManager *ConnectionManager) DeleteSession(sid uint32)

func (*ConnectionManager) GenerateUniqueSessionID

func (connectionManager *ConnectionManager) GenerateUniqueSessionID() uint32

func (*ConnectionManager) GetRoom

func (connectionManager *ConnectionManager) GetRoom(roomId uint32) face.IRoom

func (*ConnectionManager) GetSession

func (connectionManager *ConnectionManager) GetSession(sid uint32) face.ISession

type MatchManager

type MatchManager struct {
	// contains filtered or unexported fields
}

func (*MatchManager) EnterMatchQueue

func (match *MatchManager) EnterMatchQueue(session face.ISession)

func (*MatchManager) GenerateNewRoom

func (match *MatchManager) GenerateNewRoom()

func (*MatchManager) QuitMatchQueue

func (match *MatchManager) QuitMatchQueue(session face.ISession)

func (*MatchManager) UpdateMatchQueue

func (match *MatchManager) UpdateMatchQueue(message *pb.PbMessage, session face.ISession)

type Request

type Request struct {
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(message []byte, sid uint32) *Request

func (*Request) GetMessage

func (request *Request) GetMessage() []byte

func (*Request) GetRoom

func (request *Request) GetRoom() face.IRoom

func (*Request) GetSession

func (request *Request) GetSession() face.ISession

func (*Request) GetSid

func (request *Request) GetSid() uint32

type Server

type Server struct {
	IP    string
	UDPIP string
}

func (*Server) ListenKCP

func (server *Server) ListenKCP()

KCP就是建立连接后的正常业务

func (*Server) ListenUDP

func (server *Server) ListenUDP()

UDP用于用户初次连接,分配一个KCPsession给他

func (server *Server) PrintLogo()

func (*Server) Start

func (server *Server) Start()

func (*Server) Stop

func (server *Server) Stop()

type Session

type Session struct {
	// contains filtered or unexported fields
}

func (*Session) ChangeRoomId

func (session *Session) ChangeRoomId(roomId uint32)

func (*Session) CheckAlive

func (session *Session) CheckAlive()

func (*Session) GetConnection

func (session *Session) GetConnection() net.Conn

func (*Session) GetCurrentRoomId

func (session *Session) GetCurrentRoomId() uint32

func (*Session) GetRemoteAddress

func (session *Session) GetRemoteAddress() string

func (*Session) GetSid

func (session *Session) GetSid() uint32

func (*Session) SendMessage

func (session *Session) SendMessage(data []byte)

func (*Session) Start

func (session *Session) Start()

func (*Session) StartReader

func (session *Session) StartReader()

func (*Session) StartWriter

func (session *Session) StartWriter()

func (*Session) Stop

func (session *Session) Stop()

type TestStruct

type TestStruct struct {
	// contains filtered or unexported fields
}

func (*TestStruct) Print

func (test *TestStruct) Print()

func (*TestStruct) Test

func (test *TestStruct) Test()

type WorkerPool

type WorkerPool struct {
	WorkerPoolSize uint32
	TaskQueue      []chan face.IRequest
	// contains filtered or unexported fields
}

func (*WorkerPool) AddToTaskQueue

func (workerPool *WorkerPool) AddToTaskQueue(request face.IRequest)

func (*WorkerPool) DoMessageHandler

func (workerPool *WorkerPool) DoMessageHandler(request face.IRequest)

func (*WorkerPool) ResponseLogin

func (workerPool *WorkerPool) ResponseLogin(sid uint32)

func (*WorkerPool) ResponseTest

func (workerPool *WorkerPool) ResponseTest(session face.ISession)

test

func (*WorkerPool) Start

func (workerPool *WorkerPool) Start()

func (*WorkerPool) StartOneWorker

func (workerPool *WorkerPool) StartOneWorker(workerID int, taskQueue chan face.IRequest)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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