[e-cvs] cvs commit: e/src/jsrc/net/captp/jcomm ProxyConnection.java RemoteHandler.java

markm@eros.cs.jhu.edu markm@eros.cs.jhu.edu
Fri, 14 Sep 2001 22:03:41 -0400


markm       01/09/14 22:03:41

  Modified:    src/esrc/scripts updoc.e
               src/jsrc/net/captp/jcomm ProxyConnection.java
                        RemoteHandler.java
  Log:
  the 0.8.10alpha1 release.  Some CapTP bugs fixed

Revision  Changes    Path
1.16      +2 -2      e/src/esrc/scripts/updoc.e

Index: updoc.e
===================================================================
RCS file: /cvs/e/src/esrc/scripts/updoc.e,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- updoc.e	2001/09/14 04:55:01	1.15
+++ updoc.e	2001/09/15 02:03:40	1.16
@@ -588,9 +588,9 @@
 
 def args := interp getArgs()
 def names := if (args == []) {
-    ["c:/windows/desktop/multi-test.updoc"]
+    # ["c:/windows/desktop/multi-test.updoc"]
     # ["d:/e/doc/elang/intro/finding-text.html"]
-    # throw("usage: updoc.e files...")
+    throw("usage: updoc.e files...")
 } else if (args size() == 1) {
     args
 } else {



1.27      +31 -6     e/src/jsrc/net/captp/jcomm/ProxyConnection.java

Index: ProxyConnection.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/captp/jcomm/ProxyConnection.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- ProxyConnection.java	2001/09/14 20:54:04	1.26
+++ ProxyConnection.java	2001/09/15 02:03:41	1.27
@@ -763,6 +763,7 @@
     private void whyNoDeliverOp(int answerPos, Object rdr,
                                 int recipPos, String verb, Throwable problem)
     {
+        Ref broke = Ref.broken(problem);
         //Note: trace level is warning
         if (Trace.captp.warning && Trace.ON) {
             Trace.captp.warningm(
@@ -770,8 +771,8 @@
                                 recipPos + ", " + verb + ", ???)",
                 problem);
         }
-        myAnswers.put(-answerPos, problem, true);
-        E.sendOnly(problem, "whenMoreResolved", rdr);
+        myAnswers.put(-answerPos, broke, true);
+        E.sendOnly(broke, "whenMoreResolved", rdr);
     }
 
     /**
@@ -856,12 +857,24 @@
         if (null != myOptProblem) {
             throw ExceptionMgr.asSafe(myOptProblem);
         }
+        ByteArrayOutputStream bos;
+        Serializer ser;
         try {
-            ByteArrayOutputStream bos = new ByteArrayOutputStream();
-            Serializer ser = makeMsg(bos, DELIVER_ONLY_OP);
+            bos = new ByteArrayOutputStream();
+            ser = makeMsg(bos, DELIVER_ONLY_OP);
             ser.writeInt(recipPos);
             ser.writeUTF(verb);
+        } catch (Throwable problem) {
+            killConnection(problem, false);
+            throw ExceptionMgr.asSafe(problem);
+        }
+        try {
             ser.writeObject(args);
+        } catch (Throwable problem) {
+            //don't kill the connection for a serialization problem
+            throw ExceptionMgr.asSafe(problem);
+        }
+        try {
             sendMsg(bos, ser);
         } catch (Throwable problem) {
             killConnection(problem, false);
@@ -887,14 +900,26 @@
         if (null != myOptProblem) {
             throw ExceptionMgr.asSafe(myOptProblem);
         }
+        ByteArrayOutputStream bos;
+        Serializer ser;
         try {
-            ByteArrayOutputStream bos = new ByteArrayOutputStream();
-            Serializer ser = makeMsg(bos, DELIVER_OP);
+            bos = new ByteArrayOutputStream();
+            ser = makeMsg(bos, DELIVER_OP);
             ser.writeInt(answerPos);
             ser.writeObject(rdr);
             ser.writeInt(recipPos);
             ser.writeUTF(verb);
+        } catch (Throwable problem) {
+            killConnection(problem, false);
+            throw ExceptionMgr.asSafe(problem);
+        }
+        try {
             ser.writeObject(args);
+        } catch (Throwable problem) {
+            //don't kill the connection for a serialization problem
+            throw ExceptionMgr.asSafe(problem);
+        }
+        try {
             sendMsg(bos, ser);
         } catch (Throwable problem) {
             killConnection(problem, false);



1.15      +26 -21    e/src/jsrc/net/captp/jcomm/RemoteHandler.java

Index: RemoteHandler.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/captp/jcomm/RemoteHandler.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- RemoteHandler.java	2001/09/14 20:54:04	1.14
+++ RemoteHandler.java	2001/09/15 02:03:41	1.15
@@ -100,15 +100,25 @@
 
     /**
      * Handles this special case separately, so subclasses can override
-     * separately, and returns whether the case was specially handled.
+     * separately.
      * <p>
-     * The default implementation up here currently just returns false.
+     * The default implementation up here tries to deliver-only the
+     * whenMoreResolved, but if that throws an exception back at us, ie, if
+     * the whenMoreResolved message seems to be unable to get through, we
+     * report a broken reference (broken by that problen) to the reactor as
+     * the resolution.
      */
-    /*package*/ boolean handleWhenMoreResolved(Object reactor) {
-        //when we do three vats, we should check if reactor is a remote
-        //reference to yet a third vat, in which case we should shorten
-        //rather than forward.
-        return false; //XXX for now
+    /*package*/ void handleWhenMoreResolved(Object reactor) {
+        //XXX when we do three vats for real, we should check if reactor is
+        //a remote reference to yet a third vat, in which case we should
+        //shorten rather than forward.
+        Object[] args = { reactor };
+        try {
+            myConn.sendDeliverOnlyOp(myPos, "whenMoreResolved", args);
+        } catch (Throwable problem) {
+            Ref broke = Ref.broken(problem);
+            E.sendOnly(reactor, "run", broke);
+        }
     }
 
     /**
@@ -118,9 +128,8 @@
      * The default implementation up here stores the reactor in
      * myBreakageReactors.
      */
-    /*package*/ boolean handleWhenBroken(Object reactor) {
+    /*package*/ void handleWhenBroken(Object reactor) {
         myBreakageReactors.push(reactor);
-        return true;
     }
 
 
@@ -140,14 +149,11 @@
      */
     public void handleSendAllOnly(String verb, Object[] args) {
         if (1 == args.length) {
-            if ("whenMoreResolved".equals(verb) &&
-                handleWhenMoreResolved(args[0])) {
+            if ("whenMoreResolved".equals(verb)) {
+                handleWhenMoreResolved(args[0]);
 
-                return;
-
-            } else if ("whenBroken".equals(verb) &&
-                       handleWhenBroken(args[0])) {
-                return;
+            } else if ("whenBroken".equals(verb)) {
+                handleWhenBroken(args[0]);
             }
         }
         myConn.sendDeliverOnlyOp(myPos, verb, args);
@@ -158,13 +164,12 @@
      */
     public Ref handleSendAll(String verb, Object[] args) {
         if (1 == args.length) {
-            if ("whenMoreResolved".equals(verb) &&
-                handleWhenMoreResolved(args[0])) {
-
+            if ("whenMoreResolved".equals(verb)) {
+                handleWhenMoreResolved(args[0]);
                 return E.send(null, "yourself");
 
-            } else if ("whenBroken".equals(verb) &&
-                       handleWhenBroken(args[0])) {
+            } else if ("whenBroken".equals(verb)) {
+                handleWhenBroken(args[0]);
                 return E.send(null, "yourself");
             }
         }