forked from I2P_Developers/i2p.i2p
2005-12-22 jrandom
* Cleaned up some buffer synchronization issues in I2PSnark that could cause blockage.
This commit is contained in:
@ -167,7 +167,7 @@ public class ConnectionAcceptor implements Runnable
|
|||||||
|
|
||||||
if (true) {
|
if (true) {
|
||||||
in = new BufferedInputStream(in);
|
in = new BufferedInputStream(in);
|
||||||
out = new BufferedOutputStream(out);
|
//out = new BufferedOutputStream(out);
|
||||||
}
|
}
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Handling socket from " + _socket.getPeerDestination().calculateHash().toBase64());
|
_log.debug("Handling socket from " + _socket.getPeerDestination().calculateHash().toBase64());
|
||||||
|
@ -94,6 +94,10 @@ public class I2PSnarkUtil {
|
|||||||
opts.setProperty("i2p.streaming.inactivityTimeout", "90000");
|
opts.setProperty("i2p.streaming.inactivityTimeout", "90000");
|
||||||
if (opts.getProperty("i2p.streaming.inactivityAction") == null)
|
if (opts.getProperty("i2p.streaming.inactivityAction") == null)
|
||||||
opts.setProperty("i2p.streaming.inactivityAction", "1");
|
opts.setProperty("i2p.streaming.inactivityAction", "1");
|
||||||
|
if (opts.getProperty("i2p.streaming.writeTimeout") == null)
|
||||||
|
opts.setProperty("i2p.streaming.writeTimeout", "90000");
|
||||||
|
if (opts.getProperty("i2p.streaming.readTimeout") == null)
|
||||||
|
opts.setProperty("i2p.streaming.readTimeout", "90000");
|
||||||
_manager = I2PSocketManagerFactory.createManager(_i2cpHost, _i2cpPort, opts);
|
_manager = I2PSocketManagerFactory.createManager(_i2cpHost, _i2cpPort, opts);
|
||||||
}
|
}
|
||||||
return (_manager != null);
|
return (_manager != null);
|
||||||
|
@ -180,7 +180,10 @@ public class Peer implements Comparable
|
|||||||
InputStream in = sock.getInputStream();
|
InputStream in = sock.getInputStream();
|
||||||
OutputStream out = sock.getOutputStream(); //new BufferedOutputStream(sock.getOutputStream());
|
OutputStream out = sock.getOutputStream(); //new BufferedOutputStream(sock.getOutputStream());
|
||||||
if (true) {
|
if (true) {
|
||||||
out = new BufferedOutputStream(out);
|
// buffered output streams are internally synchronized, so we can't get through to the underlying
|
||||||
|
// I2PSocket's MessageOutputStream to close() it if we are blocking on a write(...). Oh, and the
|
||||||
|
// buffer is unnecessary anyway, as unbuffered access lets the streaming lib do the 'right thing'.
|
||||||
|
//out = new BufferedOutputStream(out);
|
||||||
in = new BufferedInputStream(sock.getInputStream());
|
in = new BufferedInputStream(sock.getInputStream());
|
||||||
}
|
}
|
||||||
//BufferedInputStream bis
|
//BufferedInputStream bis
|
||||||
|
@ -208,8 +208,8 @@ class PeerConnectionOut implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** remove messages not sent in 2m */
|
/** remove messages not sent in 3m */
|
||||||
private static final int SEND_TIMEOUT = 120*1000;
|
private static final int SEND_TIMEOUT = 3*60*1000;
|
||||||
private class RemoveTooSlow implements SimpleTimer.TimedEvent {
|
private class RemoveTooSlow implements SimpleTimer.TimedEvent {
|
||||||
private Message _m;
|
private Message _m;
|
||||||
public RemoveTooSlow(Message m) {
|
public RemoveTooSlow(Message m) {
|
||||||
|
@ -160,22 +160,23 @@ public class PeerCoordinator implements PeerListener
|
|||||||
public void halt()
|
public void halt()
|
||||||
{
|
{
|
||||||
halted = true;
|
halted = true;
|
||||||
|
List removed = new ArrayList();
|
||||||
synchronized(peers)
|
synchronized(peers)
|
||||||
{
|
{
|
||||||
// Stop peer checker task.
|
// Stop peer checker task.
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
|
|
||||||
// Stop peers.
|
// Stop peers.
|
||||||
Iterator it = peers.iterator();
|
removed.addAll(peers);
|
||||||
while(it.hasNext())
|
peers.clear();
|
||||||
{
|
peerCount = 0;
|
||||||
Peer peer = (Peer)it.next();
|
|
||||||
peer.disconnect();
|
|
||||||
it.remove();
|
|
||||||
removePeerFromPieces(peer);
|
|
||||||
}
|
|
||||||
peerCount = peers.size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (removed.size() > 0) {
|
||||||
|
Peer peer = (Peer)removed.remove(0);
|
||||||
|
peer.disconnect();
|
||||||
|
removePeerFromPieces(peer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void connected(Peer peer)
|
public void connected(Peer peer)
|
||||||
|
@ -162,12 +162,14 @@ public class TrackerClient extends I2PThread
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Random r = new Random();
|
||||||
while(!stop)
|
while(!stop)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Sleep some minutes...
|
// Sleep some minutes...
|
||||||
Thread.sleep(SLEEP*60*1000);
|
int delay = SLEEP*60*1000 + r.nextInt(120*1000);
|
||||||
|
Thread.sleep(delay);
|
||||||
}
|
}
|
||||||
catch(InterruptedException interrupt)
|
catch(InterruptedException interrupt)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
$Id: history.txt,v 1.365 2005/12/19 21:01:37 jrandom Exp $
|
$Id: history.txt,v 1.366 2005/12/21 07:04:56 jrandom Exp $
|
||||||
|
|
||||||
|
2005-12-22 jrandom
|
||||||
|
* Cleaned up some buffer synchronization issues in I2PSnark that could
|
||||||
|
cause blockage.
|
||||||
|
|
||||||
2005-12-21 jrandom
|
2005-12-21 jrandom
|
||||||
* Adjusted I2PSnark's usage of the streaming lib (tweaking it for BT's
|
* Adjusted I2PSnark's usage of the streaming lib (tweaking it for BT's
|
||||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RouterVersion {
|
public class RouterVersion {
|
||||||
public final static String ID = "$Revision: 1.314 $ $Date: 2005/12/19 21:01:37 $";
|
public final static String ID = "$Revision: 1.315 $ $Date: 2005/12/21 07:04:55 $";
|
||||||
public final static String VERSION = "0.6.1.7";
|
public final static String VERSION = "0.6.1.7";
|
||||||
public final static long BUILD = 8;
|
public final static long BUILD = 9;
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||||
System.out.println("Router ID: " + RouterVersion.ID);
|
System.out.println("Router ID: " + RouterVersion.ID);
|
||||||
|
Reference in New Issue
Block a user