Mercurial > hg > RemoteEditor > REPSessionManager
changeset 45:10f1adf6d74d
*** empty log message ***
author | pin |
---|---|
date | Sun, 11 Nov 2007 00:26:35 +0900 |
parents | 618d76c06b9e |
children | 4fdeeb2d5645 |
files | rep/REPPacketSend.java rep/SessionList.java rep/SessionManager.java |
diffstat | 3 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/rep/REPPacketSend.java Sun Nov 11 00:19:19 2007 +0900 +++ b/rep/REPPacketSend.java Sun Nov 11 00:26:35 2007 +0900 @@ -17,6 +17,9 @@ public ByteBuffer pack(REPCommand command){ System.out.println("send command: " + command.toString()); + if(command.string == null){ + command.setString("test"); + } ByteBuffer buffer = ByteBuffer.allocateDirect(24+(command.string).length()*2); buffer.clear(); // position = 0 buffer.putInt(command.cmd); buffer.putInt(command.sid); buffer.putInt(command.eid); @@ -61,7 +64,7 @@ public void send(REPCommand command){ try { - socketchannel.write(packUConv(command)); + socketchannel.write(pack(command)); //System.out.println(command.toString()); } catch (IOException e) { e.printStackTrace();
--- a/rep/SessionList.java Sun Nov 11 00:19:19 2007 +0900 +++ b/rep/SessionList.java Sun Nov 11 00:26:35 2007 +0900 @@ -144,7 +144,7 @@ Editor editor2 = null; Editor editor3; // LinkedList <Editor> editorList = session3.get(repCmd.sid).getEditorList(); - LinkedList <Editor> editorList = session4.get(repCmd.sid).getEditorList(); //ここもforループで検索しないといけないよ。 + LinkedList <Editor> editorList = session4.get(repCmd.sid-1).getEditorList(); //ここもforループで検索しないといけないよ。 for(Editor editor : editorList){ SocketChannel channel2 = editor.getChannel(); if(channel.equals(channel2)){
--- a/rep/SessionManager.java Sun Nov 11 00:19:19 2007 +0900 +++ b/rep/SessionManager.java Sun Nov 11 00:26:35 2007 +0900 @@ -10,6 +10,8 @@ import java.nio.channels.SocketChannel; import java.util.StringTokenizer; +import rep.xml.SessionXMLEncoder; + //+-------+--------+--------+-------+--------+---------+------+ //| cmd | session| editor | seqid | lineno | textsiz | text | //| | id | id | | | | | @@ -172,6 +174,8 @@ smList.add(channel); repCmd.setCMD(REP.SMCMD_SM_JOIN_ACK); smList.sendSessionList(sessionlist, repCmd); + }else { + } break; @@ -278,7 +282,14 @@ //REPCommand sm_join_com = REPCommand.SMCMD_SESSION_JOIN; //String socketString = getSocketString(sessionchannel); //sm_join_com.setString(sm_join_com.string + ":" + socketString); - send.send(REPCommand.SMCMD_SESSION_JOIN); + SessionXMLEncoder encoder = new SessionXMLEncoder(sessionlist.getList()); + + REPCommand comm = new REPCommand(); + comm.setCMD(REP.SMCMD_SM_JOIN); + comm.setString(encoder.sessionListToXML()); + send.send(comm); + + //send.send(REPCommand.SMCMD_SESSION_JOIN); smList.add(sessionchannel); smList.setMaster(sessionchannel); }catch (IOException e) {