타입 미스매치 수정

This commit is contained in:
2023-07-11 12:31:35 +09:00
parent a42eb2888e
commit d7b26608df

View File

@ -322,19 +322,17 @@ func (sh *subhandler) mainLoop(ctx context.Context) {
case *commandMessage: case *commandMessage:
if usermsg.Cmd == commandType_JoinRoom && len(usermsg.Args) == 2 { if usermsg.Cmd == commandType_JoinRoom && len(usermsg.Args) == 2 {
accid := usermsg.Args[0].(string) roomName := usermsg.Args[0].(string)
roomName := usermsg.Args[1].(string) accid := usermsg.Args[1].(primitive.ObjectID)
conn := entireConns[accid.Hex()]
conn := entireConns[accid]
if conn != nil { if conn != nil {
findRoom(roomName, true).in(conn) findRoom(roomName, true).in(conn)
break break
} }
} else if usermsg.Cmd == commandType_LeaveRoom && len(usermsg.Args) == 2 { } else if usermsg.Cmd == commandType_LeaveRoom && len(usermsg.Args) == 2 {
accid := usermsg.Args[0].(string) roomName := usermsg.Args[0].(string)
roomName := usermsg.Args[1].(string) accid := usermsg.Args[1].(primitive.ObjectID)
conn := entireConns[accid.Hex()]
conn := entireConns[accid]
if conn != nil { if conn != nil {
if room := findRoom(roomName, false); room != nil { if room := findRoom(roomName, false); room != nil {
room.out(conn) room.out(conn)
@ -376,18 +374,16 @@ func (sh *subhandler) mainLoop(ctx context.Context) {
case *commandMessage: case *commandMessage:
if usermsg.Cmd == commandType_JoinRoom && len(usermsg.Args) == 2 { if usermsg.Cmd == commandType_JoinRoom && len(usermsg.Args) == 2 {
accid := usermsg.Args[0].(string) roomName := usermsg.Args[0].(string)
roomName := usermsg.Args[1].(string) accid := usermsg.Args[1].(primitive.ObjectID)
conn := entireConns[accid.Hex()]
conn := entireConns[accid]
if conn != nil { if conn != nil {
findRoom(roomName, true).in(conn) findRoom(roomName, true).in(conn)
} }
} else if usermsg.Cmd == commandType_LeaveRoom && len(usermsg.Args) == 2 { } else if usermsg.Cmd == commandType_LeaveRoom && len(usermsg.Args) == 2 {
accid := usermsg.Args[0].(string) roomName := usermsg.Args[0].(string)
roomName := usermsg.Args[1].(string) accid := usermsg.Args[1].(primitive.ObjectID)
conn := entireConns[accid.Hex()]
conn := entireConns[accid]
if conn != nil { if conn != nil {
if room := findRoom(roomName, false); room != nil { if room := findRoom(roomName, false); room != nil {
room.out(conn) room.out(conn)