Mercurial > hg > RemoteEditor > REPSessionManager
comparison rep/FirstConnector.java @ 360:b25f832f875d
*** empty log message ***
author | kono |
---|---|
date | Sun, 19 Oct 2008 20:30:52 +0900 |
parents | fa041bae35f1 |
children | c965ef2b5fd6 |
comparison
equal
deleted
inserted
replaced
359:fa041bae35f1 | 360:b25f832f875d |
---|---|
33 //エディタとchannelは1対1 (ではないかも) | 33 //エディタとchannelは1対1 (ではないかも) |
34 //エディタが新しくputする場合は新しくソケットを作る | 34 //エディタが新しくputする場合は新しくソケットを作る |
35 // 1対1でない場合は、multiplexerを挿めば良い | 35 // 1対1でない場合は、multiplexerを挿めば良い |
36 Editor editor = manager.newEditor(channel); | 36 Editor editor = manager.newEditor(channel); |
37 editor.setHost(manager.myHost); | 37 editor.setHost(manager.myHost); |
38 command.eid = editor.eid; | |
39 command.sid = -1; | |
40 editor.setSID(-1); | |
38 fw = editor; | 41 fw = editor; |
39 break; | 42 break; |
40 } | 43 } |
41 case SMCMD_PUT: | 44 case SMCMD_PUT: |
42 { | 45 { |
43 // 新しいeditorとsessionをここで作る。eid,sidは、 | 46 // 新しいeditorとsessionをここで作る。eid,sidは、 |
44 // session manager IDが付いているので、global unique | 47 // session manager IDが付いているので、global unique |
45 Editor editor = manager.newEditor(channel); | 48 Editor editor = manager.newEditor(channel); |
46 Session session = manager.newSession(editor); | 49 Session session = manager.newSession(editor); |
50 session.setName(command.string); | |
51 editor.setName(command.string); | |
47 editor.setSID(session.getSID()); | 52 editor.setSID(session.getSID()); |
48 editor.setHost(manager.myHost); | 53 command.eid = editor.eid; |
54 command.sid = editor.sid; | |
49 fw = editor; | 55 fw = editor; |
50 break; | 56 break; |
51 } | 57 } |
52 case SMCMD_SM_JOIN: | 58 case SMCMD_SM_JOIN: |
53 { | 59 { |
62 default: throw new IOException(); | 68 default: throw new IOException(); |
63 } | 69 } |
64 //myHost を設定。 | 70 //myHost を設定。 |
65 //立ち上げ時にやるとlocalhostしか取れない | 71 //立ち上げ時にやるとlocalhostしか取れない |
66 if(manager.myHost == null) manager.setMyHostName(getLocalHostName()); | 72 if(manager.myHost == null) manager.setMyHostName(getLocalHostName()); |
67 | 73 fw.setHost(manager.myHost); |
68 fw.setMode(command.cmd); | 74 fw.setMode(command.cmd); |
69 manager.registerChannel(channel, fw); | 75 manager.registerChannel(channel, fw); |
70 manager.sessionManage(fw, command); | 76 manager.sessionManage(fw, command); |
71 | 77 |
72 } | 78 } |