CVS: beepcore-java/src/org/beepcore/beep/profile/echo EchoProfile.java,1.17,1.18

Huston Franklin <[email protected]> Sat, 13 Sep 2003 21:17:41 -0700
Newsgroups gmane.network.beep.beepcore.java.cvs
Message-ID <[email protected]>
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/echo
In directory sc8-pr-cvs1:/tmp/cvs-serv19895/src/org/beepcore/beep/profile/echo

Modified Files:
	EchoProfile.java 
Log Message:
Removed reply thread

Index: EchoProfile.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/echo/EchoProfile.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** EchoProfile.java	10 Jun 2003 18:59:21 -0000	1.17
--- EchoProfile.java	14 Sep 2003 04:17:39 -0000	1.18
***************
*** 71,114 ****
      public void receiveMSG(MessageMSG message)
      {
!         new ReplyThread(message).start();
!     }
  
!     private class ReplyThread extends Thread {
!         private MessageMSG message;
! 
!         ReplyThread(MessageMSG message) {
!             this.message = message;
!         }
! 
!         public void run() {
!             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) {
!                     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;
              }
          }
      }
--- 71,102 ----
      public void receiveMSG(MessageMSG message)
      {
!         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) {
+                 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;
          }
      }



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf