src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/SSLFlowDelegate.java
branchhttp-client-branch
changeset 56044 a8423a38386e
parent 56035 2f3f5da13c4c
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/SSLFlowDelegate.java	Mon Jan 29 18:12:36 2018 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/SSLFlowDelegate.java	Tue Jan 30 13:52:40 2018 +0000
@@ -578,6 +578,7 @@
                     writer.addData(HS_TRIGGER);
                 }
             } catch (Throwable ex) {
+                errorCommon(ex);
                 handleError(ex);
             }
         }
@@ -707,23 +708,23 @@
 
     private void executeTasks(List<Runnable> tasks) {
         exec.execute(() -> {
-            handshakeState.getAndUpdate((current) -> current | DOING_TASKS);
-            List<Runnable> nextTasks = tasks;
-            do {
-                try {
-                    nextTasks.forEach((r) -> {
-                        r.run();
-                    });
+            try {
+                handshakeState.getAndUpdate((current) -> current | DOING_TASKS);
+                List<Runnable> nextTasks = tasks;
+                do {
+                    nextTasks.forEach(Runnable::run);
                     if (engine.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
                         nextTasks = obtainTasks();
-                    } else break;
-                } catch (Throwable t) {
-                    handleError(t);
-                }
-            } while(true);
-            handshakeState.getAndUpdate((current) -> current & ~DOING_TASKS);
-            writer.addData(HS_TRIGGER);
-            resumeActivity();
+                    } else {
+                        break;
+                    }
+                } while (true);
+                handshakeState.getAndUpdate((current) -> current & ~DOING_TASKS);
+                writer.addData(HS_TRIGGER);
+                resumeActivity();
+            } catch (Throwable t) {
+                handleError(t);
+            }
         });
     }