Mercurial Hosting > luan
comparison src/org/eclipse/jetty/io/nio/SslConnection.java @ 952:669769bcdf5c
simplify AsyncEndPoint
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 12 Oct 2016 19:47:45 -0600 |
parents | 89fe80dfab2c |
children | 1094975d013b |
comparison
equal
deleted
inserted
replaced
951:e542a9cc75ef | 952:669769bcdf5c |
---|---|
59 private int _allocations; | 59 private int _allocations; |
60 private SslBuffers _buffers; | 60 private SslBuffers _buffers; |
61 private NIOBuffer _inbound; | 61 private NIOBuffer _inbound; |
62 private NIOBuffer _unwrapBuf; | 62 private NIOBuffer _unwrapBuf; |
63 private NIOBuffer _outbound; | 63 private NIOBuffer _outbound; |
64 private AsyncEndPoint _aEndp; | 64 private final AsyncEndPoint _aEndp; |
65 private boolean _allowRenegotiate=true; | 65 private boolean _allowRenegotiate=true; |
66 private boolean _handshook; | 66 private boolean _handshook; |
67 private boolean _ishut; | 67 private boolean _ishut; |
68 private boolean _oshut; | 68 private boolean _oshut; |
69 private final AtomicBoolean _progressed = new AtomicBoolean(); | 69 private final AtomicBoolean _progressed = new AtomicBoolean(); |
83 _out=new IndirectNIOBuffer(packetSize); | 83 _out=new IndirectNIOBuffer(packetSize); |
84 _unwrap=new IndirectNIOBuffer(appSize); | 84 _unwrap=new IndirectNIOBuffer(appSize); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 /* ------------------------------------------------------------ */ | 88 public SslConnection(SSLEngine engine,AsyncEndPoint endp) |
89 public SslConnection(SSLEngine engine,EndPoint endp) | |
90 { | 89 { |
91 this(engine,endp,System.currentTimeMillis()); | 90 this(engine,endp,System.currentTimeMillis()); |
92 } | 91 } |
93 | 92 |
94 /* ------------------------------------------------------------ */ | 93 private SslConnection(SSLEngine engine,AsyncEndPoint endp, long timeStamp) |
95 public SslConnection(SSLEngine engine,EndPoint endp, long timeStamp) | |
96 { | 94 { |
97 super(endp,timeStamp); | 95 super(endp,timeStamp); |
98 _engine=engine; | 96 _engine=engine; |
99 _session=_engine.getSession(); | 97 _session=_engine.getSession(); |
100 _aEndp=(AsyncEndPoint)endp; | 98 _aEndp=endp; |
101 _sslEndPoint = newSslEndPoint(); | 99 _sslEndPoint = new SslEndPoint(); |
102 } | |
103 | |
104 /* ------------------------------------------------------------ */ | |
105 protected SslEndPoint newSslEndPoint() | |
106 { | |
107 return new SslEndPoint(); | |
108 } | 100 } |
109 | 101 |
110 /* ------------------------------------------------------------ */ | 102 /* ------------------------------------------------------------ */ |
111 /** | 103 /** |
112 * @return True if SSL re-negotiation is allowed (default false) | 104 * @return True if SSL re-negotiation is allowed (default false) |
602 if (buffer.buffer() instanceof NIOBuffer) | 594 if (buffer.buffer() instanceof NIOBuffer) |
603 return ((NIOBuffer)buffer.buffer()).getByteBuffer(); | 595 return ((NIOBuffer)buffer.buffer()).getByteBuffer(); |
604 return ByteBuffer.wrap(buffer.array()); | 596 return ByteBuffer.wrap(buffer.array()); |
605 } | 597 } |
606 | 598 |
607 /* ------------------------------------------------------------ */ | 599 public SslEndPoint getSslEndPoint() |
608 public AsyncEndPoint getSslEndPoint() | |
609 { | 600 { |
610 return _sslEndPoint; | 601 return _sslEndPoint; |
611 } | 602 } |
612 | 603 |
613 /* ------------------------------------------------------------ */ | 604 /* ------------------------------------------------------------ */ |
614 public String toString() | 605 public String toString() |
615 { | 606 { |
616 return String.format("%s %s", super.toString(), _sslEndPoint); | 607 return String.format("%s %s", super.toString(), _sslEndPoint); |
617 } | 608 } |
618 | 609 |
619 /* ------------------------------------------------------------ */ | 610 |
620 /* ------------------------------------------------------------ */ | 611 public final class SslEndPoint implements AsyncEndPoint |
621 public class SslEndPoint implements AsyncEndPoint | |
622 { | 612 { |
623 public SSLEngine getSslEngine() | 613 public SSLEngine getSslEngine() |
624 { | 614 { |
625 return _engine; | 615 return _engine; |
626 } | 616 } |
741 public void dispatch() | 731 public void dispatch() |
742 { | 732 { |
743 _aEndp.dispatch(); | 733 _aEndp.dispatch(); |
744 } | 734 } |
745 | 735 |
746 public void scheduleWrite() | |
747 { | |
748 _aEndp.scheduleWrite(); | |
749 } | |
750 | |
751 public void onIdleExpired(long idleForMs) | |
752 { | |
753 _aEndp.onIdleExpired(idleForMs); | |
754 } | |
755 | |
756 public void setCheckForIdle(boolean check) | 736 public void setCheckForIdle(boolean check) |
757 { | 737 { |
758 _aEndp.setCheckForIdle(check); | 738 _aEndp.setCheckForIdle(check); |
759 } | |
760 | |
761 public boolean isCheckForIdle() | |
762 { | |
763 return _aEndp.isCheckForIdle(); | |
764 } | |
765 | |
766 public boolean isWritable() | |
767 { | |
768 return _aEndp.isWritable(); | |
769 } | 739 } |
770 | 740 |
771 public boolean hasProgressed() | 741 public boolean hasProgressed() |
772 { | 742 { |
773 return _progressed.getAndSet(false); | 743 return _progressed.getAndSet(false); |