Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0b22c75

Browse filesBrowse files
author
liuyang
committed
fix: 谢谢源码例子 感觉对netty稍微能理解一点点了 发现两处笔误 望采纳
1 parent 6cbcb87 commit 0b22c75
Copy full SHA for 0b22c75

File tree

Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed
Open diff view settings
Collapse file

‎Spring-Netty/src/main/java/com/bruis/learnnetty/im/console/ConsoleCommandManager.java‎

Copy file name to clipboardExpand all lines: Spring-Netty/src/main/java/com/bruis/learnnetty/im/console/ConsoleCommandManager.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class ConsoleCommandManager implements ConsoleCommand {
1919
public ConsoleCommandManager() {
2020
consoleCommandMap = new HashMap<>();
2121
consoleCommandMap.put("sendToUser", new SendToUserConsoleCommand());
22-
consoleCommandMap.put("logout", new LoginConsoleCommand());
22+
consoleCommandMap.put("logout", new LogoutConsoleCommand());
2323
consoleCommandMap.put("createGroup", new CreateGroupConsoleCommand());
2424
consoleCommandMap.put("joinGroup", new JoinGroupConsoleCommand());
2525
consoleCommandMap.put("quitGroup", new QuitGroupConsoleCommand());
Collapse file

‎Spring-Netty/src/main/java/com/bruis/learnnetty/im/console/LoginConsoleCommand.java‎

Copy file name to clipboardExpand all lines: Spring-Netty/src/main/java/com/bruis/learnnetty/im/console/LoginConsoleCommand.java
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ public void exec(Scanner scanner, Channel channel) {
1717
LoginRequestPacket loginRequestPacket = new LoginRequestPacket();
1818

1919
System.out.print("输入用户名登录: ");
20-
loginRequestPacket.setUserName(scanner.nextLine());
20+
String userIdStr; // 在退出登录logout之后 这里会读取到最后一个回车符 用户名就是空字符串会导致无法退出登录
21+
while ((userIdStr = scanner.nextLine()).isEmpty()) {
22+
System.out.println("用户名异常, 请重新输入");
23+
}
24+
loginRequestPacket.setUserName(userIdStr);
2125
loginRequestPacket.setPassword("pwd");
2226

2327
// 发送登录数据包

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.