process

package
v0.0.0-...-2bf1368 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientMgr

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

func (*ClientMgr) AddClient

func (p *ClientMgr) AddClient(userId int, client *UserProcessor)

说明一个 ClientProcessor 实例,就对应一个登录的用户

func (*ClientMgr) DelClient

func (p *ClientMgr) DelClient(userId int)

当有一个用户离线后,就从onlineUsers切片中删除掉

func (*ClientMgr) GetAllUsers

func (p *ClientMgr) GetAllUsers() map[int]*UserProcessor

func (*ClientMgr) GetClient

func (p *ClientMgr) GetClient(userId int) (client *UserProcessor, err error)

type UserProcessor

type UserProcessor struct {
	Conn net.Conn

	Buf [8192]byte
	// contains filtered or unexported fields
}

UserProcessor.go 相当于一个控制器,装用于处理与用户相关的 同时每登录一个用户,就对应一个UserProcessor的实例, 因此也可以看做是登录的用户

func (*UserProcessor) NotifyOthersUserOnline

func (up *UserProcessor) NotifyOthersUserOnline(userId int)

func (*UserProcessor) NotifyUserOnline

func (up *UserProcessor) NotifyUserOnline(userId int)

func (*UserProcessor) ServerProcessLogin

func (up *UserProcessor) ServerProcessLogin(msg *common.Message) (err error)

func (*UserProcessor) ServerProcessRegister

func (up *UserProcessor) ServerProcessRegister(msg *common.Message) (err error)

处理用户注册嘻嘻

Jump to

Keyboard shortcuts

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