0
|
1 package rep;
|
|
2
|
|
3 import java.io.IOException;
|
|
4 import java.net.InetSocketAddress;
|
11
|
5 import java.net.SocketAddress;
|
2
|
6 import java.nio.channels.SelectableChannel;
|
0
|
7 import java.nio.channels.SelectionKey;
|
|
8 import java.nio.channels.Selector;
|
|
9 import java.nio.channels.ServerSocketChannel;
|
|
10 import java.nio.channels.SocketChannel;
|
83
|
11 import java.util.LinkedList;
|
15
|
12 import java.util.StringTokenizer;
|
0
|
13
|
56
|
14 import rep.xml.SessionXMLDecoder;
|
45
|
15 import rep.xml.SessionXMLEncoder;
|
|
16
|
1
|
17 //+-------+--------+--------+-------+--------+---------+------+
|
|
18 //| cmd | session| editor | seqid | lineno | textsiz | text |
|
|
19 //| | id | id | | | | |
|
|
20 //+-------+--------+--------+-------+--------+---------+------+
|
|
21 //o-------header section (network order)-------------o
|
|
22 /*int cmd; // command
|
101
|
23 int sid; // session ID : uniqu to editing file
|
|
24 int eid; // editor ID : owner editor ID = 1。Session に対してユニーク
|
|
25 int seqno; // Sequence number : sequence number はエディタごとに管理
|
1
|
26 int lineno; // line number
|
101
|
27 int textsize; // textsize : bytesize
|
1
|
28 byte[] text;*/
|
|
29
|
8
|
30 public class SessionManager implements ConnectionListener, REPActionListener{
|
0
|
31
|
|
32
|
|
33 private SessionList sessionlist;
|
5
|
34 //SocketChannel sessionchannel;
|
83
|
35 private SessionManagerGUI gui;
|
2
|
36 private Selector selector;
|
7
|
37 private SessionManagerList smList;
|
17
|
38 private String myHost;
|
21
|
39 private boolean isMaster = true;
|
77
|
40 private EditorList allEditorList;
|
78
|
41 private String maxHost;
|
76
|
42 //private boolean addressIsGlobal;
|
6
|
43 //private SocketChannel sessionchannel;
|
7
|
44 //private boolean co;
|
95
|
45 private static int temp_port;
|
|
46 private static int send_port;
|
101
|
47
|
|
48 static final int DEFAULT_PORT = 8766;
|
|
49
|
2
|
50 public SessionManager(int port) {
|
83
|
51 gui = new SessionManagerGUI();
|
2
|
52 }
|
|
53
|
|
54 public void openSelector() throws IOException{
|
|
55 selector = Selector.open();
|
|
56 }
|
0
|
57
|
|
58 public void sessionManagerNet(int port) throws InterruptedException, IOException {
|
2
|
59
|
0
|
60 ServerSocketChannel ssc = ServerSocketChannel.open();
|
101
|
61 ssc.configureBlocking(false); //reuse address 必須
|
|
62
|
|
63 ssc.socket().setReuseAddress(true);
|
|
64
|
0
|
65 ssc.socket().bind(new InetSocketAddress(port));
|
|
66 ssc.register(selector, SelectionKey.OP_ACCEPT);
|
6
|
67
|
|
68
|
0
|
69 sessionlist = new SessionList();
|
7
|
70 smList = new SessionManagerList();
|
77
|
71 allEditorList = new EditorList();
|
0
|
72
|
|
73 while(true){
|
|
74 selector.select();
|
|
75 for(SelectionKey key : selector.selectedKeys()){
|
|
76 if(key.isAcceptable()){
|
28
|
77 /*** serverChannelはenableになったSelectionKeyのchannel ***/
|
|
78 ServerSocketChannel serverChannel = (ServerSocketChannel)key.channel();
|
9
|
79 /*** EditorChannel を用いない記述 ***/
|
28
|
80 SocketChannel channel = serverChannel.accept(); //keyからchannelを取って、accept
|
2
|
81 registerChannel (selector, channel, SelectionKey.OP_READ);
|
0
|
82 channel = null;
|
9
|
83
|
|
84 /*** EditorChannel を用いた記述 ****/
|
|
85 //EditorChannel echannel = (EditorChannel) ssc.accept();
|
|
86 //echannel.setIO();
|
|
87 //registerChannel(selector, echannel, SelectionKey.OP_READ);
|
|
88 //echannel = null;
|
|
89
|
|
90 /*** SelectableEditorChannel ***/
|
|
91 //SocketChannel channel = ssc.accept();
|
|
92 //SelectableEditorChannel echannel2 = new SelectableEditorChannel(channel);
|
|
93 //registerChannel(selector, echannel2, SelectionKey.OP_READ);
|
|
94 //channel = null;
|
|
95 //echannel2 = null;
|
|
96
|
6
|
97 }else if(key.isReadable()){
|
9
|
98
|
|
99 /*** EditorChannel を用いない記述 ***/
|
0
|
100 SocketChannel channel = (SocketChannel)key.channel();
|
75
|
101 REPPacketReceive receive = new REPPacketReceive(channel); //getPacket(), putPacket() にする。
|
|
102 receive.setkey(key);
|
53
|
103 //REPCommand repCom = repRec.unpackUConv();
|
75
|
104 REPCommand receivedCommand = receive.unpack();
|
|
105 manager(channel, receivedCommand);
|
9
|
106
|
|
107 /*** EditorChannel を用いた記述 ****/
|
|
108 //EditorChannel echannel = (EditorChannel) key.channel();
|
|
109 //REPCommand command = echannel.getPacket();
|
|
110 //manager(echannel, command);
|
|
111
|
6
|
112 }else if(key.isConnectable()){
|
|
113 System.out.println("Connectable");
|
21
|
114 }
|
0
|
115 }
|
|
116 }
|
|
117 }
|
1
|
118
|
2
|
119 private synchronized void registerChannel(Selector selector, SelectableChannel channel, int ops) throws IOException {
|
|
120 if(channel == null) {
|
|
121 return;
|
|
122 }
|
9
|
123 //System.out.println("registerChannel()");
|
2
|
124 channel.configureBlocking(false);
|
6
|
125 selector.wakeup();
|
2
|
126 channel.register(selector, ops);
|
|
127 }
|
|
128
|
75
|
129 private void manager(SocketChannel channel, REPCommand receivedCommand) {
|
|
130 if(receivedCommand == null) return;
|
69
|
131 Editor editor;
|
|
132 Session session;
|
75
|
133 REPCommand sendCommand = receivedCommand.clone();
|
78
|
134 REPPacketSend send = new REPPacketSend(channel);
|
|
135 //SessionXMLEncoder encoder = new SessionXMLEncoder();
|
75
|
136
|
|
137 switch(receivedCommand.cmd){
|
38
|
138
|
0
|
139 case REP.SMCMD_JOIN:
|
105
|
140 editor = new Editor(channel);
|
|
141 int tempeid = allEditorList.addEditor(editor);
|
83
|
142 gui.setComboEditor(tempeid, channel);
|
|
143
|
38
|
144 break;
|
31
|
145
|
1
|
146 case REP.SMCMD_JOIN_ACK:
|
31
|
147 // editorList.setEID(repCmd);
|
|
148 // editorList.sendJoinAck(repCmd);
|
|
149 // sessionmanagerGUI.setComboEditor(repCmd.eid, channel);
|
1
|
150 break;
|
31
|
151
|
0
|
152 case REP.SMCMD_PUT:
|
69
|
153 editor = new Editor(channel);
|
90
|
154 editor.setHost(myHost);
|
92
|
155 allEditorList.addEditor(editor);
|
56
|
156 editor.setEID(1);
|
75
|
157 editor.setName(receivedCommand.string);
|
69
|
158 session = new Session(editor);
|
67
|
159 session.setOwner(true);
|
63
|
160 session.addEditor(editor);
|
56
|
161 sessionlist.addSession(session);
|
83
|
162 gui.setComboSession(session.getSID(), session.getName());
|
|
163 gui.setComboEditor(editor.getEID(), editor.getChannel());
|
56
|
164 session.addToRoutingTable(editor);
|
84
|
165 sendCommand.setCMD(REP.SMCMD_PUT_ACK);
|
|
166 sendCommand.setEID(1);
|
|
167 sendCommand.setSID(session.getSID());
|
|
168 editor.send(sendCommand);
|
56
|
169
|
|
170 //if(isMaster){
|
78
|
171 SessionXMLEncoder sessionEncoder = new SessionXMLEncoder(session);
|
56
|
172 REPCommand command = new REPCommand();
|
|
173 command.setSID(session.getSID());
|
78
|
174 command.setString(sessionEncoder.sessionListToXML());
|
98
|
175
|
|
176 command.setCMD(REP.SMCMD_UPDATE);
|
|
177 smList.sendExcept(channel, command);
|
|
178
|
|
179
|
|
180 // if(isMaster){
|
|
181 // command.setCMD(REP.SMCMD_UPDATE_ACK);
|
|
182 // smList.sendToSlave(command);
|
|
183 // }else{
|
|
184 // command.setCMD(REP.SMCMD_UPDATE);
|
|
185 // smList.sendToMaster(command);
|
|
186 // }
|
38
|
187 break;
|
31
|
188
|
9
|
189 // case REP.SMCMD_PUT_ACK:
|
|
190 // break;
|
31
|
191
|
0
|
192 case REP.SMCMD_SELECT:
|
66
|
193 // sessionlist.addEditor(channel, repCmd.sid, repCmd); //sessionlistへ追加
|
70
|
194 editor = new Editor(channel);
|
94
|
195
|
75
|
196 session = sessionlist.getSession(receivedCommand.sid);
|
94
|
197
|
70
|
198 if(session.isOwner()){
|
83
|
199 int eid2 = session.addEditor(editor);
|
|
200 editor.setEID(eid2);
|
78
|
201 //REPPacketSend send = new REPPacketSend(channel);
|
84
|
202 //receivedCommand.setCMD(REP.SMCMD_SELECT_ACK);
|
|
203 //receivedCommand.setEID(eid2);
|
|
204 sendCommand.setCMD(REP.SMCMD_SELECT_ACK);
|
|
205 sendCommand.setEID(eid2);
|
|
206 send.send(sendCommand);
|
66
|
207 }else {
|
85
|
208 Editor master = session.getMaster();
|
|
209 master.send(receivedCommand);
|
94
|
210 session.addEditor(editor);
|
66
|
211 }
|
|
212
|
8
|
213 break;
|
38
|
214
|
8
|
215 case REP.SMCMD_SELECT_ACK:
|
85
|
216
|
|
217 String hostport = receivedCommand.string;
|
|
218 Editor editor2 = allEditorList.getEditor(hostport);
|
|
219 if(editor2 != null) {
|
|
220 REPCommand command2 = new REPCommand();
|
|
221 command2.setCMD(REP.SMCMD_JOIN_ACK);
|
93
|
222 command2.setSID(receivedCommand.sid);
|
85
|
223 command2.setEID(receivedCommand.eid);
|
|
224 editor2.send(command2);
|
|
225 }else{
|
|
226 smList.sendExcept(channel, receivedCommand);
|
|
227 }
|
|
228
|
|
229 //receivedCommand.setCMD(REP.SMCMD_JOIN_ACK);
|
|
230 //receivedCommand.setEID(receivedCommand.eid);
|
|
231 //session = sessionlist.getSession(receivedCommand.sid);
|
|
232 //session.sendToEditor(receivedCommand);
|
69
|
233 //Editor editor3 = session3.getEditorList().get(0);
|
|
234 //REPPacketSend send = new REPPacketSend(editor3.getChannel());
|
|
235 //send.send(repCmd);
|
1
|
236 break;
|
38
|
237
|
8
|
238 case REP.SMCMD_SM_JOIN:
|
78
|
239
|
83
|
240 //SessionManagerのリストへ追加
|
|
241 smList.add(channel);
|
|
242
|
78
|
243 //XMLからSessionListオブジェクトを生成する。
|
77
|
244 SessionXMLDecoder decoder = new SessionXMLDecoder();
|
79
|
245 SessionList receivedSessionList = decoder.decode(receivedCommand.string);
|
78
|
246
|
83
|
247 //SessionListへ追加し変換テーブルを生成する。
|
|
248 sessionlist.update(channel, receivedSessionList);
|
|
249
|
78
|
250 //myHost を設定。
|
76
|
251 if(myHost == null) setMyHostName(getLocalHostName(channel));
|
78
|
252
|
79
|
253 //maxHost を設定。
|
95
|
254 if(setMaxHost(channel, receivedSessionList.getMaxHost())){
|
|
255 sendCommand = new REPCommand();
|
|
256 sendCommand.setCMD(REP.SMCMD_CH_MASTER);
|
|
257 sendCommand.setString(maxHost);
|
|
258 smList.sendExcept(channel, sendCommand);
|
|
259 }
|
77
|
260
|
78
|
261 //SessionListからXMLを生成。
|
|
262 //joinしてきたSessionManagerに対してACKを送信。
|
|
263 SessionXMLEncoder sessionlistEncoder = new SessionXMLEncoder(sessionlist);
|
|
264 sendCommand = new REPCommand();
|
|
265 sendCommand.setCMD(REP.SMCMD_SM_JOIN_ACK);
|
|
266 sendCommand.setString(sessionlistEncoder.sessionListToXML());
|
|
267 send.send(sendCommand);
|
|
268
|
83
|
269 //その他の SessionManager に対して SMCMD_UPDATEを 送信。
|
78
|
270 sendCommand = new REPCommand();
|
83
|
271 sendCommand.setCMD(REP.SMCMD_UPDATE);
|
78
|
272 sendCommand.setString(receivedCommand.string);
|
|
273 smList.sendExcept(channel, sendCommand);
|
|
274
|
83
|
275 //その他のSessionManagerに対してSMCMD_SM_JOINを送信。
|
|
276 //sendCommand = new REPCommand();
|
|
277 //sendCommand.setCMD(REP.SMCMD_SM_JOIN);
|
|
278 //sendCommand.setString(receivedCommand.string);
|
|
279 //smList.sendExcept(channel, sendCommand);
|
|
280
|
31
|
281 if(isMaster){
|
45
|
282 }else {
|
31
|
283 }
|
78
|
284
|
8
|
285 break;
|
38
|
286
|
8
|
287 case REP.SMCMD_SM_JOIN_ACK:
|
82
|
288
|
|
289 //XMLからSessionListオブジェクトを生成。
|
|
290 SessionXMLDecoder decoder2 = new SessionXMLDecoder();
|
|
291 SessionList receivedSessionList2 = decoder2.decode(receivedCommand.string);
|
|
292
|
|
293 //maxHostを決定。
|
95
|
294 if(setMaxHost(channel, receivedSessionList2.getMaxHost())){
|
|
295 sendCommand = new REPCommand();
|
|
296 sendCommand.setCMD(REP.SMCMD_CH_MASTER);
|
|
297 sendCommand.setString(maxHost);
|
|
298 smList.sendExcept(channel, sendCommand);
|
|
299 }
|
82
|
300
|
38
|
301 if(isMaster){
|
39
|
302 }else{
|
38
|
303 }
|
|
304
|
6
|
305 break;
|
38
|
306
|
8
|
307 case REP.SMCMD_UPDATE:
|
70
|
308
|
99
|
309 SessionXMLDecoder decoder3 = new SessionXMLDecoder();
|
|
310 SessionList receivedSessionList3 = decoder3.decode(receivedCommand.string);
|
|
311
|
|
312 //SessionListへ追加し変換テーブルを生成する。
|
|
313 sessionlist.update(channel, receivedSessionList3);
|
|
314
|
|
315 smList.sendExcept(channel, receivedCommand);
|
70
|
316
|
100
|
317 for(Session session3 : receivedSessionList3.getList()){
|
|
318 gui.setComboSession(session3.getSID(), session3.getName());
|
|
319 }
|
|
320
|
99
|
321 //SessionのownerのEditor
|
|
322 //editor = new Editor(channel);
|
|
323 //editor.setName(receivedCommand.string);
|
|
324
|
|
325
|
70
|
326
|
99
|
327 //session = new Session(editor);
|
|
328 //session.addEditor(editor);
|
70
|
329
|
99
|
330 //sessionlist.addSession(session);
|
|
331
|
|
332 //gui.setComboSession(session.getSID(), session.getName());
|
70
|
333
|
83
|
334 //if(isMaster){
|
|
335 // receivedCommand.setCMD(REP.SMCMD_UPDATE_ACK);
|
|
336 // smList.sendToSlave(receivedCommand);
|
|
337 //}else{
|
|
338 // receivedCommand.setCMD(REP.SMCMD_UPDATE);
|
|
339 // smList.sendToMaster(receivedCommand);
|
|
340 //}
|
9
|
341 break;
|
38
|
342
|
9
|
343 case REP.SMCMD_UPDATE_ACK:
|
75
|
344 if(receivedCommand.sid > sessionlist.getList().size()){
|
73
|
345 editor = new Editor(channel);
|
75
|
346 editor.setName(receivedCommand.string);
|
73
|
347
|
|
348 session = new Session(editor);
|
|
349 session.addEditor(editor);
|
|
350
|
|
351 sessionlist.addSession(session);
|
|
352
|
83
|
353 gui.setComboSession(session.getSID(), session.getName());
|
73
|
354 }
|
75
|
355 smList.sendToSlave(receivedCommand);
|
1
|
356 break;
|
38
|
357
|
3
|
358 case REP.REPCMD_READ:
|
17
|
359 //sessionlist.sendCmd(channel, repCmd);
|
3
|
360 break;
|
38
|
361
|
95
|
362 case REP.SMCMD_CH_MASTER:
|
|
363 //maxHost を設定。
|
|
364 if(setMaxHost(channel, receivedCommand.string)){
|
|
365 sendCommand = new REPCommand();
|
|
366 sendCommand.setCMD(REP.SMCMD_CH_MASTER);
|
|
367 sendCommand.setString(maxHost);
|
|
368 smList.sendExcept(channel, sendCommand);
|
|
369 }
|
|
370 break;
|
|
371
|
0
|
372 default:
|
9
|
373 //sessionlist.sendCmd(channel, repCmd);
|
75
|
374 sessionlist.sendToNextEditor(channel, receivedCommand);
|
0
|
375 break;
|
|
376 }
|
|
377 }
|
83
|
378
|
79
|
379 private boolean setMaxHost(SocketChannel channel, String host) {
|
81
|
380 if(maxHost == null) {
|
|
381 maxHost = myHost;
|
|
382 sessionlist.setMaxHost(maxHost);
|
|
383 }
|
82
|
384 if(host.compareTo(maxHost) > 0){
|
79
|
385 //host > MaxHost なら maxHost = host
|
|
386 //masterを設定する。
|
|
387 maxHost = host;
|
|
388 sessionlist.setMaxHost(maxHost);
|
|
389 setMaster(false, channel);
|
|
390 return true;
|
|
391 }else{
|
|
392 return false;
|
|
393 }
|
78
|
394 }
|
|
395
|
76
|
396 private void setMyHostName(String localHostName) {
|
95
|
397 myHost = localHostName + temp_port;
|
81
|
398 if(maxHost == null) {
|
|
399 maxHost = myHost;
|
|
400 sessionlist.setMaxHost(maxHost);
|
|
401 }
|
77
|
402 allEditorList.setHost(myHost);
|
76
|
403 }
|
0
|
404
|
77
|
405 private void setMaster(boolean b, SocketChannel channel) {
|
75
|
406 isMaster = b;
|
|
407 System.out.println("isMaster = " + b);
|
77
|
408 smList.setMaster(channel);
|
75
|
409 }
|
|
410
|
0
|
411 public static void main(String[] args) throws InterruptedException, IOException {
|
101
|
412 int port = DEFAULT_PORT;
|
|
413 int port_s = DEFAULT_PORT;
|
1
|
414
|
82
|
415 if(args.length > 0){
|
39
|
416 port = Integer.parseInt(args[0]);
|
95
|
417 port_s = Integer.parseInt(args[1]);
|
0
|
418 }
|
95
|
419 temp_port = port;
|
|
420 send_port = port_s;
|
0
|
421 SessionManager sm = new SessionManager(port);
|
2
|
422 sm.openSelector();
|
|
423 sm.openWindow();
|
0
|
424 sm.sessionManagerNet(port);
|
|
425 }
|
|
426
|
2
|
427 private void openWindow() {
|
83
|
428 Thread th = new Thread( gui );
|
2
|
429 th.start();
|
75
|
430 //System.out.println(sessionmanagerGUI.toString());
|
83
|
431 gui.addConnectionListener(this);
|
|
432 gui.addREPActionListener(this);
|
2
|
433 }
|
|
434
|
|
435 private void connectSession(String host) {
|
101
|
436 int port = DEFAULT_PORT;
|
95
|
437 port = send_port;
|
1
|
438 InetSocketAddress addr = new InetSocketAddress(host, port);
|
|
439 try {
|
6
|
440 SocketChannel sessionchannel = SocketChannel.open();
|
1
|
441 sessionchannel.configureBlocking(true);
|
|
442 sessionchannel.connect(addr);
|
6
|
443 while(!sessionchannel.finishConnect()){
|
77
|
444 System.out.print("test afro");
|
6
|
445 }
|
|
446 System.out.println("");
|
2
|
447 registerChannel(selector, sessionchannel, SelectionKey.OP_READ);
|
45
|
448
|
77
|
449 sm_join(sessionchannel);
|
45
|
450
|
1
|
451 }catch (IOException e) {
|
|
452 e.printStackTrace();
|
|
453 }
|
|
454 }
|
77
|
455
|
|
456 private void sm_join(SocketChannel channel){
|
79
|
457
|
|
458 //SM_JOINコマンドを生成。
|
77
|
459 REPCommand command = new REPCommand();
|
|
460 command.setCMD(REP.SMCMD_SM_JOIN);
|
79
|
461
|
|
462 //hostnameをセット。
|
82
|
463 setMyHostName(getLocalHostName(channel));
|
|
464
|
|
465 //XMLを生成。送信コマンドにセット。
|
77
|
466 SessionXMLEncoder encoder = new SessionXMLEncoder(sessionlist);
|
|
467 String string = encoder.sessionListToXML();
|
|
468 command.setString(string);
|
|
469
|
79
|
470 //SM_JOINコマンドを送信。
|
77
|
471 REPPacketSend send = new REPPacketSend(channel);
|
|
472 send.send(command);
|
|
473
|
79
|
474 //SessionManagerのListに追加。
|
77
|
475 smList.add(channel);
|
|
476 }
|
2
|
477
|
75
|
478 private String getLocalHostName(SocketChannel channel) {
|
74
|
479 String host = null;
|
|
480 host = channel.socket().getLocalAddress().getHostName();
|
|
481 return host;
|
|
482 }
|
|
483
|
77
|
484 // private String getSocketString(SocketChannel sessionchannel) {
|
|
485 // SocketAddress socket = sessionchannel.socket().getRemoteSocketAddress();
|
|
486 // //String inetAddressString = sessionchannel.socket().getInetAddress().toString();
|
|
487 // StringTokenizer stn = new StringTokenizer(socket.toString(), "/");
|
|
488 // String socketString = null;
|
|
489 // while(stn.hasMoreTokens()){
|
|
490 // socketString = stn.nextToken();
|
|
491 // //System.out.println(socketString);
|
|
492 // }
|
|
493 // return socketString;
|
|
494 // }
|
14
|
495
|
2
|
496 public void connectionOccured(ConnectionEvent event) {
|
|
497 connectSession(event.getHost());
|
|
498 }
|
8
|
499
|
|
500 public void ActionOccured(REPActionEvent event) {
|
103
|
501
|
104
|
502 SocketChannel editorChannel = event.getEditorChannel();
|
|
503 int sid = event.getSID();
|
|
504 Editor editor = new Editor(editorChannel);
|
|
505 editor.setHost(this.myHost);
|
|
506 Session session = sessionlist.getSession(sid);
|
|
507 session.addEditor(editor);
|
|
508
|
|
509 Editor owner = session.getMaster();
|
|
510
|
|
511 REPCommand command = new REPCommand();
|
|
512 command.setCMD(REP.SMCMD_SELECT);
|
|
513 command.setSID(sid);
|
|
514 command.setString(editor.getHost() + ":" + editor.getPort());
|
|
515 owner.send(command);
|
103
|
516
|
|
517 /*** 書き直し ***/
|
104
|
518 // SocketChannel channel = event.getEditorChannel();
|
|
519 // int sid = event.getSID();
|
|
520 // Session session = sessionlist.getSession(sid);
|
|
521 // if(session.isOwner()){
|
|
522 // int eid = session.addEditor(new Editor(channel));
|
|
523 // REPCommand sendCommand = new REPCommand();
|
|
524 // sendCommand.setCMD(REP.SMCMD_JOIN_ACK);
|
|
525 // sendCommand.setEID(eid);
|
|
526 // sendCommand.setSID(sid);
|
|
527 // REPPacketSend sender = new REPPacketSend(channel);
|
|
528 // sender.send(sendCommand);
|
|
529 // }else {
|
|
530 // SocketChannel editorChannel = event.getEditorChannel();
|
|
531 // sid = event.getSID();
|
|
532 // Editor editor = new Editor(editorChannel);
|
|
533 // editor.setHost(myHost);
|
|
534 // session = sessionlist.getSession(sid);
|
|
535 // session.addEditor(editor);
|
|
536 //
|
|
537 // Editor owner = session.getMaster();
|
|
538 //
|
|
539 // REPCommand command = new REPCommand();
|
|
540 // command.setCMD(REP.SMCMD_SELECT);
|
|
541 // command.setSID(sid);
|
|
542 // command.setString(editor.getHost() + ":" + editor.getPort());
|
|
543 // owner.send(command);
|
|
544 // }
|
72
|
545
|
|
546
|
84
|
547 //REPPacketSend send = new REPPacketSend(editorChannel);
|
|
548 //send.send(new REPCommand(REP.SMCMD_SELECT_ACK, sid, eid, 0,0,0,""));
|
72
|
549
|
|
550
|
|
551
|
71
|
552 //sessionlist.sendSelect(sid);
|
8
|
553 }
|
0
|
554 }
|