[Beepcore-java-commits] CVS: beepcore-java/src/org/beepcore/beep/profile/echo EchoProfile.java,1.12,
Status: Beta
Brought to you by:
huston
From: Huston F. <hu...@us...> - 2002-01-15 16:14:41
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/echo In directory usw-pr-cvs1:/tmp/cvs-serv11346/src/org/beepcore/beep/profile/echo Modified Files: EchoProfile.java Log Message: fixed to match new semantics of waitForNextSegment Index: EchoProfile.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/echo/EchoProfile.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** EchoProfile.java 2001/11/25 08:38:42 1.12 --- EchoProfile.java 2002/01/15 16:14:38 1.13 *************** *** 69,109 **** public void receiveMSG(Message message) throws BEEPError { ! new ReplyThread(message).start(); ! } ! ! private class ReplyThread extends Thread { ! private Message message; ! ! ReplyThread(Message message) { ! this.message = message; ! } ! public void run() { ! OutputDataStream data = new OutputDataStream(); ! InputDataStream ds = message.getDataStream(); ! ! while (ds.isComplete() == false || ds.availableSegment()) { ! try { ! data.add(ds.waitForNextSegment()); ! } catch (InterruptedException e) { ! message.getChannel().getSession().terminate(e.getMessage()); ! return; } } ! data.setComplete(); try { ! message.sendRPY(data); ! } catch (BEEPException e) { ! try { ! message.sendERR(BEEPError.CODE_REQUESTED_ACTION_ABORTED, "Error sending RPY"); ! } catch (BEEPException x) { ! message.getChannel().getSession().terminate(x.getMessage()); ! } ! return; } } } } --- 69,142 ---- public void receiveMSG(Message message) throws BEEPError { ! OutputDataStream data = new OutputDataStream(); ! InputDataStream ds = message.getDataStream(); ! while (true) { ! try { ! BufferSegment b = ds.waitForNextSegment(); ! if (b == null) { ! break; } + data.add(b); + } catch (InterruptedException e) { + throw new BEEPError(BEEPError.CODE_REQUESTED_ACTION_ABORTED, + "Error reading request"); } + } ! data.setComplete(); + try { + message.sendRPY(data); + } catch (BEEPException e) { try { ! throw new BEEPError(BEEPError.CODE_REQUESTED_ACTION_ABORTED, "Error sending RPY"); ! } catch (BEEPException x) { ! message.getChannel().getSession().terminate(x.getMessage()); } + return; } } + + // public void receiveMSG(Message message) throws BEEPError + // { + // new ReplyThread(message).start(); + // } + + // private class ReplyThread extends Thread { + // private Message message; + + // ReplyThread(Message message) { + // this.message = message; + // } + + // public void run() { + // OutputDataStream data = new OutputDataStream(); + // InputDataStream ds = message.getDataStream(); + + // while (ds.isComplete() == false || ds.availableSegment()) { + // try { + // data.add(ds.waitForNextSegment()); + // } catch (InterruptedException e) { + // message.getChannel().getSession().terminate(e.getMessage()); + // return; + // } + // } + + // data.setComplete(); + + // try { + // message.sendRPY(data); + // } catch (BEEPException e) { + // try { + // message.sendERR(BEEPError.CODE_REQUESTED_ACTION_ABORTED, + // "Error sending RPY"); + // } catch (BEEPException x) { + // message.getChannel().getSession().terminate(x.getMessage()); + // } + // return; + // } + // } + // } } |