Mercurial > hg > RemoteEditor > REPSessionManager
comparison rep/Forwarder.java @ 378:c78569ab5fce
*** empty log message ***
author | kono |
---|---|
date | Wed, 22 Oct 2008 04:27:52 +0900 |
parents | c4ffdac26132 |
children |
comparison
equal
deleted
inserted
replaced
377:85a5980d96d8 | 378:c78569ab5fce |
---|---|
84 | 84 |
85 private void distpatchToEditor(REPSocketChannel<REPCommand> channel, | 85 private void distpatchToEditor(REPSocketChannel<REPCommand> channel, |
86 REPCommand command) throws IOException { | 86 REPCommand command) throws IOException { |
87 Session s = manager.getSession(command.sid); | 87 Session s = manager.getSession(command.sid); |
88 if (s==null) throw new IOException(); | 88 if (s==null) throw new IOException(); |
89 Forwarder editor = s.getForwarder(channel); | 89 Forwarder f = s.getForwarder(channel); |
90 if (editor==null) throw new IOException(); | 90 if (f==null) throw new IOException(); |
91 if (!editor.isDirect()) { | 91 if (!f.isDirect()) { |
92 editor.send(command); | 92 // another forwarder, pass it to the next session manager |
93 f.send(command); | |
93 return; | 94 return; |
94 } | 95 } |
95 /* | 96 /* |
96 * local editor case. Handle special case first, usually these cases | 97 * local editor case. |
97 * are handled in the next Editor in a session manager, but | |
98 * it is forwarded here. | |
99 */ | 98 */ |
100 if (command.cmd==REP.SMCMD_QUIT_2) { | 99 Editor editor = (Editor)f; |
101 // we have to wait next editor's finishing before sending this. | 100 editor.forwardedCommandManage(command, this); |
102 // this is odd, but the editor itself does not know it's merging | |
103 // state. Only this session manager knows it. | |
104 editor.setQuit2(command); | |
105 } else if (command.eid==editor.eid) { | |
106 // if we handle in editor.manage(), this editor cannot distinguish this | |
107 // and user input command from the editor. | |
108 ((Editor)editor).checkReturnedCommand(command); | |
109 } else { | |
110 editor.manage(command); | |
111 } | |
112 } | 101 } |
113 | 102 |
114 public void setMode(REP cmd) { | 103 public void setMode(REP cmd) { |
115 mode = cmd; | 104 mode = cmd; |
116 } | 105 } |