dispatch from the timer thread to iterate

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2021-03-30 16:47:01 +02:00 committed by Simone Bordet
parent 2244be64ef
commit 5424f67132
1 changed files with 12 additions and 8 deletions

View File

@ -157,6 +157,8 @@ public abstract class QuicSession
List<Long> writableStreamIds = quicheConnection.writableStreamIds();
if (LOG.isDebugEnabled())
LOG.debug("writable stream ids: {}", writableStreamIds);
if (!writableStreamIds.isEmpty())
{
Runnable onWritable = () ->
{
for (Long writableStreamId : writableStreamIds)
@ -165,6 +167,7 @@ public abstract class QuicSession
}
};
dispatch(onWritable);
}
List<Long> readableStreamIds = quicheConnection.readableStreamIds();
if (LOG.isDebugEnabled())
@ -281,8 +284,9 @@ public abstract class QuicSession
LOG.debug("quiche timeout callback");
quicheConnection.onTimeout();
if (LOG.isDebugEnabled())
LOG.debug("re-iterating quiche after timeout");
iterate();
LOG.debug("re-iterating quiche after timeout cid={}", quicheConnectionId);
// do not use the timer thread to iterate
dispatch(() -> iterate());
}
};
}