comparison src/org/eclipse/jetty/io/nio/SslConnection.java @ 960:3cd4c706a61f

simplify ChannelEndPoint
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 13 Oct 2016 21:29:19 -0600
parents 7b94f5b33c64
children 866f2e801618
comparison
equal deleted inserted replaced
959:7b94f5b33c64 960:3cd4c706a61f
43 * <p> 43 * <p>
44 * The connector uses an {@link AsyncEndPoint} (like {@link SelectChannelEndPoint}) as 44 * The connector uses an {@link AsyncEndPoint} (like {@link SelectChannelEndPoint}) as
45 * it's source/sink of encrypted data. It then provides {@link #getSslEndPoint()} to 45 * it's source/sink of encrypted data. It then provides {@link #getSslEndPoint()} to
46 * expose a source/sink of unencrypted data to another connection (eg HttpConnection). 46 * expose a source/sink of unencrypted data to another connection (eg HttpConnection).
47 */ 47 */
48 public class SslConnection extends AbstractConnection implements AsyncConnection 48 public final class SslConnection extends AbstractConnection implements AsyncConnection
49 { 49 {
50 private final Logger _logger = LoggerFactory.getLogger("org.eclipse.jetty.io.nio.ssl"); 50 private final Logger _logger = LoggerFactory.getLogger("org.eclipse.jetty.io.nio.ssl");
51 51
52 private static final NIOBuffer __ZERO_BUFFER=new IndirectNIOBuffer(0); 52 private static final NIOBuffer __ZERO_BUFFER=new IndirectNIOBuffer(0);
53 53
165 } 165 }
166 } 166 }
167 } 167 }
168 } 168 }
169 169
170 /* ------------------------------------------------------------ */ 170 @Override
171 public Connection handle() throws IOException 171 public Connection handle() throws IOException
172 { 172 {
173 try 173 try
174 { 174 {
175 allocateBuffers(); 175 allocateBuffers();
186 186
187 // handle the delegate connection 187 // handle the delegate connection
188 AsyncConnection next = (AsyncConnection)_connection.handle(); 188 AsyncConnection next = (AsyncConnection)_connection.handle();
189 if (next!=_connection && next!=null) 189 if (next!=_connection && next!=null)
190 { 190 {
191 _connection=next; 191 _connection = next;
192 progress=true; 192 progress = true;
193 } 193 }
194 194
195 _logger.debug("{} handle {} progress={}", _session, this, progress); 195 _logger.debug("{} handle {} progress={}", _session, this, progress);
196 } 196 }
197 } 197 }
573 573
574 return result.bytesConsumed()>0 || result.bytesProduced()>0; 574 return result.bytesConsumed()>0 || result.bytesProduced()>0;
575 } 575 }
576 576
577 577
578 /* ------------------------------------------------------------ */
579 private ByteBuffer extractByteBuffer(Buffer buffer) 578 private ByteBuffer extractByteBuffer(Buffer buffer)
580 { 579 {
581 if (buffer.buffer() instanceof NIOBuffer) 580 if (buffer.buffer() instanceof NIOBuffer)
582 return ((NIOBuffer)buffer.buffer()).getByteBuffer(); 581 return ((NIOBuffer)buffer.buffer()).getByteBuffer();
583 return ByteBuffer.wrap(buffer.array()); 582 return ByteBuffer.wrap(buffer.array());
586 public SslEndPoint getSslEndPoint() 585 public SslEndPoint getSslEndPoint()
587 { 586 {
588 return _sslEndPoint; 587 return _sslEndPoint;
589 } 588 }
590 589
591 /* ------------------------------------------------------------ */
592 public String toString() 590 public String toString()
593 { 591 {
594 return String.format("%s %s", super.toString(), _sslEndPoint); 592 return String.format("%s %s", super.toString(), _sslEndPoint);
595 } 593 }
596 594
775 return _connection; 773 return _connection;
776 } 774 }
777 775
778 public void setConnection(Connection connection) 776 public void setConnection(Connection connection)
779 { 777 {
780 _connection=(AsyncConnection)connection; 778 _connection = (AsyncConnection)connection;
781 } 779 }
782 780
783 public String toString() 781 public String toString()
784 { 782 {
785 // Do NOT use synchronized (SslConnection.this) 783 // Do NOT use synchronized (SslConnection.this)