forked from I2P_Developers/i2p.i2p
* Streaming: Move streaming to new package (ticket #1135)
This commit is contained in:
@ -16,11 +16,11 @@ import java.nio.channels.SelectableChannel;
|
|||||||
*/
|
*/
|
||||||
public abstract class AcceptingChannel extends SelectableChannel {
|
public abstract class AcceptingChannel extends SelectableChannel {
|
||||||
|
|
||||||
abstract I2PSocket accept() throws I2PException, ConnectException;
|
public abstract I2PSocket accept() throws I2PException, ConnectException;
|
||||||
|
|
||||||
protected final I2PSocketManager _socketManager;
|
protected final I2PSocketManager _socketManager;
|
||||||
|
|
||||||
AcceptingChannel(I2PSocketManager manager) {
|
protected AcceptingChannel(I2PSocketManager manager) {
|
||||||
this._socketManager = manager;
|
this._socketManager = manager;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ import net.i2p.util.Log;
|
|||||||
public class I2PSocketManagerFactory {
|
public class I2PSocketManagerFactory {
|
||||||
|
|
||||||
public static final String PROP_MANAGER = "i2p.streaming.manager";
|
public static final String PROP_MANAGER = "i2p.streaming.manager";
|
||||||
public static final String DEFAULT_MANAGER = "net.i2p.client.streaming.I2PSocketManagerFull";
|
public static final String DEFAULT_MANAGER = "net.i2p.client.streaming.impl.I2PSocketManagerFull";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a socket manager using a brand new destination connected to the
|
* Create a socket manager using a brand new destination connected to the
|
||||||
|
@ -6,7 +6,7 @@ import java.util.Properties;
|
|||||||
* Define the configuration for streaming and verifying data on the socket.
|
* Define the configuration for streaming and verifying data on the socket.
|
||||||
* Use I2PSocketManager.buildOptions() to get one of these.
|
* Use I2PSocketManager.buildOptions() to get one of these.
|
||||||
*/
|
*/
|
||||||
class I2PSocketOptionsImpl implements I2PSocketOptions {
|
public class I2PSocketOptionsImpl implements I2PSocketOptions {
|
||||||
private long _connectTimeout;
|
private long _connectTimeout;
|
||||||
private long _readTimeout;
|
private long _readTimeout;
|
||||||
private long _writeTimeout;
|
private long _writeTimeout;
|
||||||
@ -93,7 +93,7 @@ class I2PSocketOptionsImpl implements I2PSocketOptions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static double getDouble(Properties opts, String name, double defaultVal) {
|
public static double getDouble(Properties opts, String name, double defaultVal) {
|
||||||
if (opts == null) return defaultVal;
|
if (opts == null) return defaultVal;
|
||||||
String val = opts.getProperty(name);
|
String val = opts.getProperty(name);
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PException;
|
import net.i2p.I2PException;
|
||||||
|
import net.i2p.client.streaming.AcceptingChannel;
|
||||||
|
import net.i2p.client.streaming.I2PSocket;
|
||||||
|
import net.i2p.client.streaming.I2PServerSocket;
|
||||||
|
import net.i2p.client.streaming.I2PSocketManager;
|
||||||
|
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
@ -29,7 +33,7 @@ class AcceptingChannelImpl extends AcceptingChannel {
|
|||||||
private volatile I2PSocket next;
|
private volatile I2PSocket next;
|
||||||
private final I2PServerSocket socket;
|
private final I2PServerSocket socket;
|
||||||
|
|
||||||
I2PSocket accept() throws I2PException, ConnectException {
|
public I2PSocket accept() throws I2PException, ConnectException {
|
||||||
I2PSocket sock;
|
I2PSocket sock;
|
||||||
try {
|
try {
|
||||||
sock = socket.accept();
|
sock = socket.accept();
|
||||||
@ -43,7 +47,7 @@ class AcceptingChannelImpl extends AcceptingChannel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AcceptingChannelImpl(I2PSocketManager manager) {
|
protected AcceptingChannelImpl(I2PSocketManager manager) {
|
||||||
super(manager);
|
super(manager);
|
||||||
// this cheats and just sets the manager timeout low in order to repeatedly poll it.
|
// this cheats and just sets the manager timeout low in order to repeatedly poll it.
|
||||||
// that means we can "only" accept one new connection every 100 milliseconds.
|
// that means we can "only" accept one new connection every 100 milliseconds.
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.data.ByteArray;
|
import net.i2p.data.ByteArray;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
@ -1,4 +1,7 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
|
import net.i2p.client.streaming.I2PSocketOptionsImpl;
|
||||||
|
import net.i2p.client.streaming.I2PSocketOptions;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -1,7 +1,11 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
import net.i2p.I2PException;
|
import net.i2p.I2PException;
|
||||||
|
import net.i2p.client.streaming.I2PServerSocket;
|
||||||
|
import net.i2p.client.streaming.AcceptingChannel;
|
||||||
|
import net.i2p.client.streaming.I2PSocket;
|
||||||
|
import net.i2p.client.streaming.I2PSocketManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bridge to allow accepting new connections
|
* Bridge to allow accepting new connections
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -10,6 +10,8 @@ import net.i2p.I2PAppContext;
|
|||||||
import net.i2p.client.I2PSession;
|
import net.i2p.client.I2PSession;
|
||||||
import net.i2p.data.Destination;
|
import net.i2p.data.Destination;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
import net.i2p.client.streaming.I2PSocket;
|
||||||
|
import net.i2p.client.streaming.I2PSocketOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bridge between the full streaming lib and the I2PSocket API
|
* Bridge between the full streaming lib and the I2PSocket API
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.NoRouteToHostException;
|
import java.net.NoRouteToHostException;
|
||||||
@ -17,7 +17,10 @@ import net.i2p.client.I2PSession;
|
|||||||
import net.i2p.client.I2PSessionException;
|
import net.i2p.client.I2PSessionException;
|
||||||
import net.i2p.data.Destination;
|
import net.i2p.data.Destination;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
import net.i2p.client.streaming.I2PSocketManager;
|
||||||
|
import net.i2p.client.streaming.I2PSocketOptions;
|
||||||
|
import net.i2p.client.streaming.I2PSocket;
|
||||||
|
import net.i2p.client.streaming.I2PServerSocket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Centralize the coordination and multiplexing of the local client's streaming.
|
* Centralize the coordination and multiplexing of the local client's streaming.
|
@ -1,4 +1,6 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
|
import net.i2p.client.streaming.I2PSocket;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
@ -9,6 +9,7 @@ import net.i2p.client.I2PSessionException;
|
|||||||
import net.i2p.client.I2PSessionMuxedListener;
|
import net.i2p.client.I2PSessionMuxedListener;
|
||||||
import net.i2p.client.streaming.I2PSocketManager.DisconnectListener;
|
import net.i2p.client.streaming.I2PSocketManager.DisconnectListener;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
import net.i2p.client.streaming.I2PSocketManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receive raw information from the I2PSession and turn it into
|
* Receive raw information from the I2PSession and turn it into
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.client.I2PSession;
|
import net.i2p.client.I2PSession;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.util.SimpleTimer2;
|
import net.i2p.util.SimpleTimer2;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
@ -9,6 +9,7 @@ import java.net.SocketException;
|
|||||||
import java.nio.channels.ServerSocketChannel;
|
import java.nio.channels.ServerSocketChannel;
|
||||||
|
|
||||||
import net.i2p.I2PException;
|
import net.i2p.I2PException;
|
||||||
|
import net.i2p.client.streaming.I2PSocket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bridge to I2PServerSocket.
|
* Bridge to I2PServerSocket.
|
@ -1,4 +1,7 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
|
import net.i2p.client.streaming.I2PSocket;
|
||||||
|
import net.i2p.client.streaming.I2PSocketOptions;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Coordinates what we do 'next'. The scheduler used by a connection is
|
* Coordinates what we do 'next'. The scheduler used by a connection is
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.client.streaming;
|
package net.i2p.client.streaming.impl;
|
||||||
|
|
||||||
import net.i2p.I2PException;
|
import net.i2p.I2PException;
|
||||||
|
|
@ -1,3 +1,6 @@
|
|||||||
|
2014-01-04 dg
|
||||||
|
* Streaming: Move streaming to new package (ticket #1135)
|
||||||
|
|
||||||
2013-12-25 dg
|
2013-12-25 dg
|
||||||
* Console: Add 'advanced warning' to /configclients
|
* Console: Add 'advanced warning' to /configclients
|
||||||
* SOCKS5Server: Remove redundant, commented out line from my previous findbugs
|
* SOCKS5Server: Remove redundant, commented out line from my previous findbugs
|
||||||
|
Reference in New Issue
Block a user