int credits = receiver.clearUnsentCredits();
transportSession.getSession().clearIncomingWindowResize();
if(credits != 0 || receiver.getDrain())
{
transportLink.addCredit(credits);
Flow flow = new Flow();
flow.setHandle(transportLink.getLocalHandle());
flow.setNextIncomingId(transportSession.getNextIncomingId());
flow.setIncomingWindow(transportSession.getIncomingWindowSize());
flow.setOutgoingWindow(transportSession.getOutgoingWindowSize());
flow.setDeliveryCount(transportLink.getDeliveryCount());
flow.setLinkCredit(transportLink.getLinkCredit());
flow.setDrain(receiver.getDrain());
flow.setNextOutgoingId(transportSession.getNextOutgoingId());
int frameBytes = writeFrame(buffer, transportSession.getLocalChannel(), flow, null, null);
written += frameBytes;
if(receiver.getLocalState() == EndpointState.ACTIVE)
{
endpoint.clearModified();
}
}
}
}
endpoint = endpoint.transportNext();
}
endpoint = _connectionEndpoint.getTransportHead();
while(endpoint != null && buffer.remaining() >= _maxFrameSize)
{
if(endpoint instanceof SessionImpl)
{
SessionImpl session = (SessionImpl) endpoint;
TransportSession transportSession = getTransportState(session);
if(session.getLocalState() == EndpointState.ACTIVE)
{
boolean windowResized = session.clearIncomingWindowResize();
if(windowResized)
{
Flow flow = new Flow();
flow.setIncomingWindow(transportSession.getIncomingWindowSize());
flow.setOutgoingWindow(transportSession.getOutgoingWindowSize());
flow.setNextOutgoingId(transportSession.getNextOutgoingId());
flow.setNextIncomingId(transportSession.getNextIncomingId());
int frameBytes = writeFrame(buffer, transportSession.getLocalChannel(), flow, null, null);
written += frameBytes;
}
}
}