2015-10-27 16:16 GMT+01:00 <r...@apache.org>:

> Author: remm
> Date: Tue Oct 27 15:16:04 2015
> New Revision: 1710835
>
> URL: http://svn.apache.org/viewvc?rev=1710835&view=rev
> Log:
> - Add an extra async IO flag I used for testing.
> - Blocking should block.
>
> It's possible I'll remove this code eventually.

SSL really gets in the way of possible gather optimizations (it wants a
direct buffer), and scatter is hard to use. I now think it will perform
worse. However, this sort of API could be used to produce a true async impl
of HTTP/2, while the current one is async/blocking, and also do away with
the plumbing for IO dispatches (they are a completion handler invocation,
end of story) and state tracking needed to avoid a true async impl.

Example (writing the GOAWAY frame):

            try {
                synchronized (socketWrapper) {
                    socketWrapper.write(true, payloadLength, 0,
payloadLength.length);
                    socketWrapper.write(true, GOAWAY, 0, GOAWAY.length);
                    socketWrapper.write(true, fixedPayload, 0, 8);
                    socketWrapper.flush(true);
                }
            } catch (IOException ioe) {
                // This is fatal for the connection. Ignore it here. There
will be
                // further attempts at I/O in upgradeDispatch() and it can
better
                // handle the IO errors.
            }

Becomes:

            socketWrapper.write(true, getWriteTimeout(),
TimeUnit.MILLISECONDS, null, SocketWrapperBase.COMPLETE_WRITE, null,
                    ByteBuffer.wrap(payloadLength),
ByteBuffer.wrap(GOAWAY), ByteBuffer.wrap(fixedPayload));

The code looks nicer IMO (I did rewrite the Http2UpgradeHandler with that
to see if it helped me debug or solved the HTTP/2 issues).

So it's "meh" overall and I won't use it for now, but I'd like to keep it
for a possible async impl.

Rémy

Reply via email to