comparison src/org/eclipse/jetty/io/nio/SslConnection.java @ 1038:b71ad168fe34

rename Buffer.length() to remaining()
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Nov 2016 22:16:11 -0600
parents 3c4c7cc7904f
children a8c92b0a08ed
comparison
equal deleted inserted replaced
1037:3c4c7cc7904f 1038:b71ad168fe34
136 synchronized (this) 136 synchronized (this)
137 { 137 {
138 if (--_allocations==0) 138 if (--_allocations==0)
139 { 139 {
140 if (_buffers!=null && 140 if (_buffers!=null &&
141 _inbound.length()==0 && 141 _inbound.remaining()==0 &&
142 _outbound.length()==0 && 142 _outbound.remaining()==0 &&
143 _unwrapBuf.length()==0) 143 _unwrapBuf.remaining()==0)
144 { 144 {
145 _inbound=null; 145 _inbound=null;
146 _outbound=null; 146 _outbound=null;
147 _unwrapBuf=null; 147 _unwrapBuf=null;
148 __buffers.set(_buffers); 148 __buffers.set(_buffers);
277 _endp.close(); 277 _endp.close();
278 throw e; 278 throw e;
279 } 279 }
280 finally 280 finally
281 { 281 {
282 _logger.debug("{} {} {} filled={}/{} flushed={}/{}",_session,this,_engine.getHandshakeStatus(),filled,_inbound.length(),flushed,_outbound.length()); 282 _logger.debug("{} {} {} filled={}/{} flushed={}/{}",_session,this,_engine.getHandshakeStatus(),filled,_inbound.remaining(),flushed,_outbound.remaining());
283 } 283 }
284 284
285 // handle the current hand share status 285 // handle the current hand share status
286 switch(_engine.getHandshakeStatus()) 286 switch(_engine.getHandshakeStatus())
287 { 287 {
603 _endp.close(); 603 _endp.close();
604 } 604 }
605 605
606 public int fill(Buffer buffer) throws IOException 606 public int fill(Buffer buffer) throws IOException
607 { 607 {
608 int size=buffer.length(); 608 int size=buffer.remaining();
609 process(buffer, null); 609 process(buffer, null);
610 610
611 int filled=buffer.length()-size; 611 int filled=buffer.remaining()-size;
612 612
613 if (filled==0 && isInputShutdown()) 613 if (filled==0 && isInputShutdown())
614 return -1; 614 return -1;
615 return filled; 615 return filled;
616 } 616 }
617 617
618 public int flush(Buffer buffer) throws IOException 618 public int flush(Buffer buffer) throws IOException
619 { 619 {
620 int size = buffer.length(); 620 int size = buffer.remaining();
621 process(null, buffer); 621 process(null, buffer);
622 return size-buffer.length(); 622 return size-buffer.remaining();
623 } 623 }
624 624
625 public int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException 625 public int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException
626 { 626 {
627 if (header!=null && header.hasRemaining()) 627 if (header!=null && header.hasRemaining())
735 // because it's very easy to deadlock when debugging is enabled. 735 // because it's very easy to deadlock when debugging is enabled.
736 // We do a best effort to print the right toString() and that's it. 736 // We do a best effort to print the right toString() and that's it.
737 Buffer inbound = _inbound; 737 Buffer inbound = _inbound;
738 Buffer outbound = _outbound; 738 Buffer outbound = _outbound;
739 Buffer unwrap = _unwrapBuf; 739 Buffer unwrap = _unwrapBuf;
740 int i = inbound == null? -1 : inbound.length(); 740 int i = inbound == null? -1 : inbound.remaining();
741 int o = outbound == null ? -1 : outbound.length(); 741 int o = outbound == null ? -1 : outbound.remaining();
742 int u = unwrap == null ? -1 : unwrap.length(); 742 int u = unwrap == null ? -1 : unwrap.remaining();
743 return String.format("SSL %s i/o/u=%d/%d/%d ishut=%b oshut=%b {%s}", 743 return String.format("SSL %s i/o/u=%d/%d/%d ishut=%b oshut=%b {%s}",
744 _engine.getHandshakeStatus(), 744 _engine.getHandshakeStatus(),
745 i, o, u, 745 i, o, u,
746 _ishut, _oshut, 746 _ishut, _oshut,
747 _connection); 747 _connection);