Mercurial > hg > RemoteEditor > REPSessionManager
changeset 25:2b4863af8804
*** empty log message ***
author | pin |
---|---|
date | Fri, 09 Nov 2007 16:58:42 +0900 |
parents | 7012a944e58f |
children | ad1060ba4213 |
files | rep/REP.java rep/REPCommand.java rep/SessionManagerList.java |
diffstat | 3 files changed, 26 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rep/REP.java Thu Nov 08 18:51:41 2007 +0900 +++ b/rep/REP.java Fri Nov 09 16:58:42 2007 +0900 @@ -33,5 +33,6 @@ public static final int SMCMD_SM_JOIN_ACK = 63; public static final int SMCMD_UPDATE = 65; public static final int SMCMD_UPDATE_ACK = 66; - + public static final int SMCMD_UPDATE_UP = 67; + public static final int SMCMD_UPDATE_DOWN = 68; }
--- a/rep/REPCommand.java Thu Nov 08 18:51:41 2007 +0900 +++ b/rep/REPCommand.java Fri Nov 09 16:58:42 2007 +0900 @@ -25,6 +25,10 @@ this.string = string; } + public REPCommand() { + // TODO Auto-generated constructor stub + } + public String toString(){ String repCmdString = new String(cmd + "," + sid + "," + eid + "," + seq + "," + lineno + "," + textsiz + "," + string); return repCmdString;
--- a/rep/SessionManagerList.java Thu Nov 08 18:51:41 2007 +0900 +++ b/rep/SessionManagerList.java Fri Nov 09 16:58:42 2007 +0900 @@ -8,6 +8,7 @@ private List<SocketChannel> list = new LinkedList<SocketChannel>(); private int mySMID; + private SocketChannel master; public void add(SocketChannel channel) { list.add(channel); @@ -26,5 +27,24 @@ send.send(command); } } + + public void sendUpdateUp(REPCommand command){ + REPPacketSend send = new REPPacketSend(master); + command.setCMD(REP.SMCMD_UPDATE_UP); + send.send(command); + } + + public void sendUpdateDown(REPCommand command){ + command.setCMD(REP.SMCMD_UPDATE_DOWN); + for(SocketChannel channel : list){ + if(channel == master) continue; + REPPacketSend send = new REPPacketSend(channel); + send.send(command); + } + } + + public void setMaster(SocketChannel channel){ + this.master = channel; + } }