Skip to content

Commit

Permalink
错别字&拼写错误修改
Browse files Browse the repository at this point in the history
  • Loading branch information
Mew151 committed Oct 29, 2021
1 parent 13857d5 commit 392f2fd
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/dialer/client_dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (d *ClientDialer) DialAndHandshake(ctx kim.DialerContext) (net.Conn, error)
if err != nil {
return nil, err
}
// 4. 判断是否登陆成功
// 4. 判断是否登录成功
if ack.Status != pkt.Status_Success {
return nil, fmt.Errorf("login failed: %v", &ack.Header)
}
Expand Down
8 changes: 4 additions & 4 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ func (r *Router) Use(handlers ...HandlerFunc) {
r.middlewares = append(r.middlewares, handlers...)
}

// Handle regist a commond handler
func (r *Router) Handle(commond string, handlers ...HandlerFunc) {
r.handlers.Add(commond, r.middlewares...)
r.handlers.Add(commond, handlers...)
// Handle register a command handler
func (r *Router) Handle(command string, handlers ...HandlerFunc) {
r.handlers.Add(command, r.middlewares...)
r.handlers.Add(command, handlers...)
}

// Serve a packet from client
Expand Down
2 changes: 1 addition & 1 deletion services/gateway/serv/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type Handler struct {

// Accept this connection
func (h *Handler) Accept(conn kim.Conn, timeout time.Duration) (string, kim.Meta, error) {
// 1. 读取登陆包
// 1. 读取登录包
_ = conn.SetReadDeadline(time.Now().Add(timeout))
frame, err := conn.ReadFrame()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions services/server/handler/login_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (h *LoginHandler) DoSysLogin(ctx kim.Context) {
}

log.Infof("do login of %v ", session.String())
// 2. 检查当前账号是否已经登陆在其它地方
// 2. 检查当前账号是否已经登录在其它地方
old, err := ctx.GetLocation(session.Account, "")
if err != nil && err != kim.ErrSessionNil {
_ = ctx.RespWithError(pkt.Status_SystemException, err)
Expand All @@ -43,7 +43,7 @@ func (h *LoginHandler) DoSysLogin(ctx kim.Context) {
_ = ctx.RespWithError(pkt.Status_SystemException, err)
return
}
// 5. 返回一个登陆成功的消息
// 5. 返回一个登录成功的消息
var resp = &pkt.LoginResp{
ChannelId: session.ChannelId,
Account: session.Account,
Expand Down
8 changes: 4 additions & 4 deletions services/server/serv/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ var log = logger.WithFields(logger.Fields{
type ServHandler struct {
r *kim.Router
cache kim.SessionStorage
dispatcher *ServerDispather
dispatcher *ServerDispatcher
}

func NewServHandler(r *kim.Router, cache kim.SessionStorage) *ServHandler {
return &ServHandler{
r: r,
dispatcher: &ServerDispather{},
dispatcher: &ServerDispatcher{},
cache: cache,
}
}
Expand Down Expand Up @@ -92,10 +92,10 @@ func RespErr(ag kim.Agent, p *pkt.LogicPkt, status pkt.Status) error {
return container.Push(ag.ID(), p)
}

type ServerDispather struct {
type ServerDispatcher struct {
}

func (d *ServerDispather) Push(gateway string, channels []string, p *pkt.LogicPkt) error {
func (d *ServerDispatcher) Push(gateway string, channels []string, p *pkt.LogicPkt) error {
p.AddStringMeta(wire.MetaDestChannels, strings.Join(channels, ","))
return container.Push(gateway, p)
}
Expand Down
4 changes: 2 additions & 2 deletions storage/redis_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ func (r *RedisStorage) Delete(account string, channelId string) error {
}

// GetByID get session by sessionID
func (r *RedisStorage) Get(ChannelId string) (*pkt.Session, error) {
snKey := KeySession(ChannelId)
func (r *RedisStorage) Get(channelId string) (*pkt.Session, error) {
snKey := KeySession(channelId)
bts, err := r.cli.Get(snKey).Bytes()
if err != nil {
if err == redis.Nil {
Expand Down

0 comments on commit 392f2fd

Please sign in to comment.