80 * <--------------- | | <--------------
81 * supplied to constructor | | obtained from this
82 * +------------------+
83 *
84 * Errors are reported to the downReader Flow.Subscriber
85 *
86 * }
87 * </pre>
88 */
89 public class SSLFlowDelegate {
90
91 final Logger debug =
92 Utils.getDebugLogger(this::dbgString, Utils.DEBUG);
93
94 private static final ByteBuffer SENTINEL = Utils.EMPTY_BYTEBUFFER;
95 private static final ByteBuffer HS_TRIGGER = ByteBuffer.allocate(0);
96 // When handshake is in progress trying to wrap may produce no bytes.
97 private static final ByteBuffer NOTHING = ByteBuffer.allocate(0);
98 private static final String monProp = Utils.getProperty("jdk.internal.httpclient.monitorFlowDelegate");
99 private static final boolean isMonitored =
100 monProp != null && (monProp.equals("") || monProp.equalsIgnoreCase("true"));
101
102 final Executor exec;
103 final Reader reader;
104 final Writer writer;
105 final SSLEngine engine;
106 final String tubeName; // hack
107 final CompletableFuture<String> alpnCF; // completes on initial handshake
108 final Monitorable monitor = isMonitored ? this::monitor : null; // prevent GC until SSLFD is stopped
109 volatile boolean close_notify_received;
110 final CompletableFuture<Void> readerCF;
111 final CompletableFuture<Void> writerCF;
112 final Consumer<ByteBuffer> recycler;
113 static AtomicInteger scount = new AtomicInteger(1);
114 final int id;
115
116 /**
117 * Creates an SSLFlowDelegate fed from two Flow.Subscribers. Each
118 * Flow.Subscriber requires an associated {@link CompletableFuture}
119 * for errors that need to be signaled from downstream to upstream.
120 */
|
80 * <--------------- | | <--------------
81 * supplied to constructor | | obtained from this
82 * +------------------+
83 *
84 * Errors are reported to the downReader Flow.Subscriber
85 *
86 * }
87 * </pre>
88 */
89 public class SSLFlowDelegate {
90
91 final Logger debug =
92 Utils.getDebugLogger(this::dbgString, Utils.DEBUG);
93
94 private static final ByteBuffer SENTINEL = Utils.EMPTY_BYTEBUFFER;
95 private static final ByteBuffer HS_TRIGGER = ByteBuffer.allocate(0);
96 // When handshake is in progress trying to wrap may produce no bytes.
97 private static final ByteBuffer NOTHING = ByteBuffer.allocate(0);
98 private static final String monProp = Utils.getProperty("jdk.internal.httpclient.monitorFlowDelegate");
99 private static final boolean isMonitored =
100 monProp != null && (monProp.isEmpty() || monProp.equalsIgnoreCase("true"));
101
102 final Executor exec;
103 final Reader reader;
104 final Writer writer;
105 final SSLEngine engine;
106 final String tubeName; // hack
107 final CompletableFuture<String> alpnCF; // completes on initial handshake
108 final Monitorable monitor = isMonitored ? this::monitor : null; // prevent GC until SSLFD is stopped
109 volatile boolean close_notify_received;
110 final CompletableFuture<Void> readerCF;
111 final CompletableFuture<Void> writerCF;
112 final Consumer<ByteBuffer> recycler;
113 static AtomicInteger scount = new AtomicInteger(1);
114 final int id;
115
116 /**
117 * Creates an SSLFlowDelegate fed from two Flow.Subscribers. Each
118 * Flow.Subscriber requires an associated {@link CompletableFuture}
119 * for errors that need to be signaled from downstream to upstream.
120 */
|