Mercurial Hosting > luan
comparison src/org/eclipse/jetty/io/nio/SslConnection.java @ 1072:00704b28b9f1
remove JBuffer.skip()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 10 Nov 2016 02:29:01 -0700 |
parents | b4ba8a4d5a16 |
children | 6b7ff30bb990 |
comparison
equal
deleted
inserted
replaced
1071:b4ba8a4d5a16 | 1072:00704b28b9f1 |
---|---|
126 _buffers=__buffers.get(); | 126 _buffers=__buffers.get(); |
127 if (_buffers==null) | 127 if (_buffers==null) |
128 _buffers=new SslBuffers(_session.getPacketBufferSize()*2,_session.getApplicationBufferSize()*2); | 128 _buffers=new SslBuffers(_session.getPacketBufferSize()*2,_session.getApplicationBufferSize()*2); |
129 _inbound = _buffers._in; | 129 _inbound = _buffers._in; |
130 _outbound = _buffers._out; | 130 _outbound = _buffers._out; |
131 _unwrapBuf=_buffers._unwrap; | 131 _unwrapBuf = _buffers._unwrap; |
132 __buffers.set(null); | 132 __buffers.set(null); |
133 } | 133 } |
134 } | 134 } |
135 } | 135 } |
136 } | 136 } |
169 { | 169 { |
170 progress=false; | 170 progress=false; |
171 | 171 |
172 // If we are handshook let the delegate connection | 172 // If we are handshook let the delegate connection |
173 if (_engine.getHandshakeStatus()!=HandshakeStatus.NOT_HANDSHAKING) | 173 if (_engine.getHandshakeStatus()!=HandshakeStatus.NOT_HANDSHAKING) |
174 progress=process(null,null); | 174 progress = process(null,null); |
175 | 175 |
176 // handle the delegate connection | 176 // handle the delegate connection |
177 _connection.handle(); | 177 _connection.handle(); |
178 | 178 |
179 _logger.debug("{} handle {} progress={}", _session, this, progress); | 179 _logger.debug("{} handle {} progress={}", _session, this, progress); |
210 @Override | 210 @Override |
211 public void onInputShutdown() throws IOException | 211 public void onInputShutdown() throws IOException |
212 { | 212 { |
213 } | 213 } |
214 | 214 |
215 private void put_unwrapBuf(JBuffer toFill) { | |
216 JBuffer dup = toFill.duplicate(); | |
217 dup.position(dup.limit()); | |
218 dup.limit(dup.capacity()); | |
219 dup.putQ(_unwrapBuf); | |
220 toFill.limit(dup.position()); | |
221 } | |
222 | |
215 private synchronized boolean process(JBuffer toFill, JBuffer toFlush) throws IOException | 223 private synchronized boolean process(JBuffer toFill, JBuffer toFlush) throws IOException |
216 { | 224 { |
217 boolean some_progress=false; | 225 boolean some_progress=false; |
218 try | 226 try |
219 { | 227 { |
223 // if we don't have a buffer to put received data into | 231 // if we don't have a buffer to put received data into |
224 if (toFill==null) | 232 if (toFill==null) |
225 { | 233 { |
226 // use the unwrapbuffer to hold received data. | 234 // use the unwrapbuffer to hold received data. |
227 BufferUtil.compact(_unwrapBuf); | 235 BufferUtil.compact(_unwrapBuf); |
228 toFill=_unwrapBuf; | 236 toFill = _unwrapBuf; |
229 } | 237 } |
230 // Else if the fill buffer is too small for the SSL session | 238 // Else if the fill buffer is too small for the SSL session |
231 else if (toFill.capacity()<_session.getApplicationBufferSize()) | 239 else if (toFill.capacity()<_session.getApplicationBufferSize()) |
232 { | 240 { |
233 // fill to the temporary unwrapBuffer | 241 // fill to the temporary unwrapBuffer |
234 boolean progress=process(null,toFlush); | 242 boolean progress = process(null,toFlush); |
235 | 243 |
236 // if we received any data, | 244 // if we received any data, |
237 if (_unwrapBuf!=null && _unwrapBuf.hasRemaining()) | 245 if (_unwrapBuf!=null && _unwrapBuf.hasRemaining()) |
238 { | 246 { |
239 // transfer from temp buffer to fill buffer | 247 // transfer from temp buffer to fill buffer |
240 _unwrapBuf.skip(toFill.put(_unwrapBuf)); | 248 // _unwrapBuf.skip(toFill.putJ(_unwrapBuf)); |
249 put_unwrapBuf(toFill); | |
241 return true; | 250 return true; |
242 } | 251 } |
243 else | 252 else |
244 // return progress from recursive call | 253 // return progress from recursive call |
245 return progress; | 254 return progress; |
246 } | 255 } |
247 // Else if there is some temporary data | 256 // Else if there is some temporary data |
248 else if (_unwrapBuf!=null && _unwrapBuf.hasRemaining()) | 257 else if (_unwrapBuf!=null && _unwrapBuf.hasRemaining()) |
249 { | 258 { |
250 // transfer from temp buffer to fill buffer | 259 // transfer from temp buffer to fill buffer |
251 _unwrapBuf.skip(toFill.put(_unwrapBuf)); | 260 // _unwrapBuf.skip(toFill.putJ(_unwrapBuf)); |
261 put_unwrapBuf(toFill); | |
252 return true; | 262 return true; |
253 } | 263 } |
254 | 264 |
255 // If we are here, we have a buffer ready into which we can put some read data. | 265 // If we are here, we have a buffer ready into which we can put some read data. |
256 | 266 |
577 _endp.close(); | 587 _endp.close(); |
578 } | 588 } |
579 | 589 |
580 public int fill(JBuffer buffer) throws IOException | 590 public int fill(JBuffer buffer) throws IOException |
581 { | 591 { |
582 int size=buffer.remaining(); | 592 int size = buffer.remaining(); |
583 process(buffer, null); | 593 process(buffer, null); |
584 | 594 |
585 int filled=buffer.remaining()-size; | 595 int filled=buffer.remaining()-size; |
586 | 596 |
587 if (filled==0 && isInputShutdown()) | 597 if (filled==0 && isInputShutdown()) |