fixed merge
This commit is contained in:
parent
1159111c52
commit
30776f9662
|
@ -46,7 +46,6 @@ abstract public class WriteFlusher
|
|||
{
|
||||
private static final Logger LOG = Log.getLogger(WriteFlusher.class);
|
||||
private static final boolean DEBUG = LOG.isDebugEnabled(); // Easy for the compiler to remove the code if DEBUG==false
|
||||
private static final ByteBuffer[] NO_BUFFERS = new ByteBuffer[0];
|
||||
private static final ByteBuffer[] EMPTY_BUFFERS = new ByteBuffer[]{BufferUtil.EMPTY_BUFFER};
|
||||
private static final EnumMap<StateType, Set<StateType>> __stateTransitions = new EnumMap<>(StateType.class);
|
||||
private static final State __IDLE = new IdleState();
|
||||
|
@ -405,11 +404,16 @@ abstract public class WriteFlusher
|
|||
boolean progress=true;
|
||||
while(progress && buffers!=null)
|
||||
{
|
||||
int before=buffers[0].remaining();
|
||||
int before=buffers.length==0?0:buffers[0].remaining();
|
||||
boolean flushed=_endPoint.flush(buffers);
|
||||
int r=buffers.length==0?0:buffers[0].remaining();
|
||||
|
||||
if (_endPoint.flush(buffers))
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Flushed={} {}/{}+{} {}",flushed,before-r,before,buffers.length-1,this);
|
||||
|
||||
if (flushed)
|
||||
return null;
|
||||
int r=buffers[0].remaining();
|
||||
|
||||
progress=before!=r;
|
||||
|
||||
int not_empty=0;
|
||||
|
@ -421,12 +425,16 @@ abstract public class WriteFlusher
|
|||
not_empty=0;
|
||||
break;
|
||||
}
|
||||
progress=true;
|
||||
r=buffers[not_empty].remaining();
|
||||
}
|
||||
|
||||
if (not_empty>0)
|
||||
buffers=Arrays.copyOfRange(buffers,not_empty,buffers.length);
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("!fully flushed {}",this);
|
||||
|
||||
// If buffers is null, then flush has returned false but has consumed all the data!
|
||||
// This is probably SSL being unable to flush the encrypted buffer, so return EMPTY_BUFFERS
|
||||
|
|
Loading…
Reference in New Issue