mnet

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSession

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

func NewTestStruct

func NewTestStruct() face.ITest

func ServerStartWork

func ServerStartWork()

Types

type Request

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

func NewRequest

func NewRequest(message []byte, session face.ISession) Request

func (*Request) GetMessage

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

func (*Request) GetSession

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

type Server

type Server struct {
	IP    string
	UDPIP string
	// contains filtered or unexported fields
}

func (*Server) AddSession

func (server *Server) AddSession(conn *kcp.UDPSession)

func (*Server) GetSession

func (server *Server) GetSession(sid uint32) face.ISession

func (*Server) Init

func (server *Server) Init()

func (*Server) ListenKCP

func (server *Server) ListenKCP()

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

func (*Server) ListenUDP

func (server *Server) ListenUDP()

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

func (server *Server) PrintLogo()

func (*Server) RemoveSession

func (server *Server) RemoveSession(sid uint32)

func (*Server) Serve

func (server *Server) Serve()

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 Request
	// contains filtered or unexported fields
}

func (*WorkerPool) AddToTaskQueue

func (workerPool *WorkerPool) AddToTaskQueue(request Request)

func (*WorkerPool) DoMessageHandler

func (workerPool *WorkerPool) DoMessageHandler(request Request)

func (*WorkerPool) Init

func (workerPool *WorkerPool) Init()

func (*WorkerPool) ResponseLogin

func (workerPool *WorkerPool) ResponseLogin(sid uint32)

func (*WorkerPool) ResponseTest

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

test

func (*WorkerPool) StartOneWorker

func (workerPool *WorkerPool) StartOneWorker(workerID int, taskQueue chan Request)

func (*WorkerPool) StartWorkerPool

func (workerPool *WorkerPool) StartWorkerPool()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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