mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 06:39:54 +01:00
Added factory for LanTcpPlugin.
This commit is contained in:
21
src/net/sf/briar/plugins/tcp/LanTcpPluginFactory.java
Normal file
21
src/net/sf/briar/plugins/tcp/LanTcpPluginFactory.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package net.sf.briar.plugins.tcp;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
|
import net.sf.briar.api.android.AndroidExecutor;
|
||||||
|
import net.sf.briar.api.plugins.PluginExecutor;
|
||||||
|
import net.sf.briar.api.plugins.duplex.DuplexPlugin;
|
||||||
|
import net.sf.briar.api.plugins.duplex.DuplexPluginCallback;
|
||||||
|
import net.sf.briar.api.plugins.duplex.DuplexPluginFactory;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public class LanTcpPluginFactory implements DuplexPluginFactory {
|
||||||
|
|
||||||
|
private static final long POLLING_INTERVAL = 60L * 1000L; // 1 minute
|
||||||
|
|
||||||
|
public DuplexPlugin createPlugin(@PluginExecutor Executor pluginExecutor,
|
||||||
|
AndroidExecutor androidExecutor, Context appContext,
|
||||||
|
DuplexPluginCallback callback) {
|
||||||
|
return new LanTcpPlugin(pluginExecutor, callback, POLLING_INTERVAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,8 +30,7 @@ abstract class TcpPlugin implements DuplexPlugin {
|
|||||||
|
|
||||||
protected final Executor pluginExecutor;
|
protected final Executor pluginExecutor;
|
||||||
protected final DuplexPluginCallback callback;
|
protected final DuplexPluginCallback callback;
|
||||||
|
protected final long pollingInterval;
|
||||||
private final long pollingInterval;
|
|
||||||
|
|
||||||
protected boolean running = false; // Locking: this
|
protected boolean running = false; // Locking: this
|
||||||
private ServerSocket socket = null; // Locking: this
|
private ServerSocket socket = null; // Locking: this
|
||||||
|
|||||||
Reference in New Issue
Block a user