mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 05:39:53 +01:00
Invitation API and two (untested) implementations.
This commit is contained in:
@@ -2,6 +2,9 @@ package net.sf.briar.transport;
|
||||
|
||||
import static net.sf.briar.api.transport.TransportConstants.MAX_FRAME_LENGTH;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* A thread that calls the writeFullFrame() method of a PaddedConnectionWriter
|
||||
* at regular intervals. The interval between calls is determined by a target
|
||||
@@ -10,6 +13,9 @@ import static net.sf.briar.api.transport.TransportConstants.MAX_FRAME_LENGTH;
|
||||
*/
|
||||
class FrameScheduler extends Thread {
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(FrameScheduler.class.getName());
|
||||
|
||||
private final PaddedConnectionWriter writer;
|
||||
private final int millisPerFrame;
|
||||
|
||||
@@ -27,7 +33,10 @@ class FrameScheduler extends Thread {
|
||||
if(nextCall > now) {
|
||||
try {
|
||||
Thread.sleep(nextCall - now);
|
||||
} catch(InterruptedException ignored) {}
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(Level.WARNING))
|
||||
LOG.warning(e.getMessage());
|
||||
}
|
||||
}
|
||||
lastCall = System.currentTimeMillis();
|
||||
if(!writer.writeFullFrame()) return;
|
||||
|
||||
Reference in New Issue
Block a user