I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit bc6583fe authored by zzz's avatar zzz
Browse files

merge of '0bf1803f4554f830aee970415fcd6c9b6c4d2747'

     and '98a4dbd3af97e8892dafc24a4ebbcc6b2ff30afe'
parents 249e6f0e 78d0a54e
No related branches found
No related tags found
No related merge requests found
...@@ -11,9 +11,10 @@ import java.util.Iterator; ...@@ -11,9 +11,10 @@ import java.util.Iterator;
import java.util.Set; import java.util.Set;
import net.i2p.data.Hash; import net.i2p.data.Hash;
import net.i2p.data.DataHelper import net.i2p.data.DataHelper;
import net.i2p.router.Router; import net.i2p.router.Router;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
import net.i2p.router.web.StatsGenerator;
import net.i2p.util.I2PThread; import net.i2p.util.I2PThread;
import net.i2p.util.Log; import net.i2p.util.Log;
...@@ -49,7 +50,7 @@ class AdminRunner implements Runnable { ...@@ -49,7 +50,7 @@ class AdminRunner implements Runnable {
} else if ( (command.indexOf("routerStats.html") >= 0) || (command.indexOf("oldstats.jsp") >= 0) ) { } else if ( (command.indexOf("routerStats.html") >= 0) || (command.indexOf("oldstats.jsp") >= 0) ) {
try { try {
out.write(DataHelper.getASCII("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n")); out.write(DataHelper.getASCII("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n"));
_generator.generateStatsPage(new OutputStreamWriter(out)); _generator.generateStatsPage(new OutputStreamWriter(out), true);
out.close(); out.close();
} catch (IOException ioe) { } catch (IOException ioe) {
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
...@@ -63,7 +64,8 @@ class AdminRunner implements Runnable { ...@@ -63,7 +64,8 @@ class AdminRunner implements Runnable {
} else if (true || command.indexOf("routerConsole.html") > 0) { } else if (true || command.indexOf("routerConsole.html") > 0) {
try { try {
out.write(DataHelper.getASCII("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n")); out.write(DataHelper.getASCII("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n"));
_context.router().renderStatusHTML(new OutputStreamWriter(out)); // TODO Not technically the same as router().renderStatusHTML() was
_context.routerAppManager().renderStatusHTML(new OutputStreamWriter(out));
out.close(); out.close();
} catch (IOException ioe) { } catch (IOException ioe) {
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
......
...@@ -5,6 +5,7 @@ import java.io.InputStreamReader; ...@@ -5,6 +5,7 @@ import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.Socket; import java.net.Socket;
import net.i2p.data.DataHelper;
import net.i2p.util.Log; import net.i2p.util.Log;
public class TestCreateSessionDatagram { public class TestCreateSessionDatagram {
......
...@@ -5,6 +5,7 @@ import java.io.InputStreamReader; ...@@ -5,6 +5,7 @@ import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.Socket; import java.net.Socket;
import net.i2p.data.DataHelper;
import net.i2p.util.Clock; import net.i2p.util.Clock;
import net.i2p.util.Log; import net.i2p.util.Log;
......
...@@ -37,11 +37,8 @@ public class TestDatagramTransfer { ...@@ -37,11 +37,8 @@ public class TestDatagramTransfer {
line = reader.readLine(); line = reader.readLine();
_log.info("Response from the lookup for ME: " + line); _log.info("Response from the lookup for ME: " + line);
_log.debug("The above should be a NAMING REPLY"); _log.debug("The above should be a NAMING REPLY");
StringTokenizer tok = new StringTokenizer(line); Properties props = SAMUtils.parseParams(line);
String maj = tok.nextToken();
String min = tok.nextToken();
Properties props = SAMUtils.parseParams(tok);
String value = props.getProperty("VALUE"); String value = props.getProperty("VALUE");
if (value == null) { if (value == null) {
_log.error("No value for ME found! [" + line + "]"); _log.error("No value for ME found! [" + line + "]");
...@@ -53,10 +50,7 @@ public class TestDatagramTransfer { ...@@ -53,10 +50,7 @@ public class TestDatagramTransfer {
String send = "DATAGRAM SEND DESTINATION=" + value + " SIZE=3\nYo!"; String send = "DATAGRAM SEND DESTINATION=" + value + " SIZE=3\nYo!";
out.write(DataHelper.getASCII(send)); out.write(DataHelper.getASCII(send));
line = reader.readLine(); line = reader.readLine();
tok = new StringTokenizer(line); props = SAMUtils.parseParams(line);
maj = tok.nextToken();
min = tok.nextToken();
props = SAMUtils.parseParams(tok);
String size = props.getProperty("SIZE"); String size = props.getProperty("SIZE");
String from = props.getProperty("DESTINATION"); String from = props.getProperty("DESTINATION");
if ( (value == null) || (size == null) || if ( (value == null) || (size == null) ||
......
...@@ -5,6 +5,7 @@ import java.io.InputStreamReader; ...@@ -5,6 +5,7 @@ import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.Socket; import java.net.Socket;
import net.i2p.data.DataHelper;
import net.i2p.util.Log; import net.i2p.util.Log;
public class TestDest { public class TestDest {
......
...@@ -5,6 +5,7 @@ import java.io.InputStreamReader; ...@@ -5,6 +5,7 @@ import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.Socket; import java.net.Socket;
import net.i2p.data.DataHelper;
import net.i2p.util.Log; import net.i2p.util.Log;
public class TestNaming { public class TestNaming {
......
...@@ -7,6 +7,7 @@ import java.net.Socket; ...@@ -7,6 +7,7 @@ import java.net.Socket;
import java.util.Properties; import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import net.i2p.data.DataHelper;
import net.i2p.util.Log; import net.i2p.util.Log;
public class TestRawTransfer { public class TestRawTransfer {
...@@ -36,11 +37,8 @@ public class TestRawTransfer { ...@@ -36,11 +37,8 @@ public class TestRawTransfer {
line = reader.readLine(); line = reader.readLine();
_log.info("Response from the lookup for ME: " + line); _log.info("Response from the lookup for ME: " + line);
_log.debug("The above should be a NAMING REPLY"); _log.debug("The above should be a NAMING REPLY");
StringTokenizer tok = new StringTokenizer(line); Properties props = SAMUtils.parseParams(line);
String maj = tok.nextToken();
String min = tok.nextToken();
Properties props = SAMUtils.parseParams(tok);
String value = props.getProperty("VALUE"); String value = props.getProperty("VALUE");
if (value == null) { if (value == null) {
_log.error("No value for ME found! [" + line + "]"); _log.error("No value for ME found! [" + line + "]");
...@@ -53,10 +51,7 @@ public class TestRawTransfer { ...@@ -53,10 +51,7 @@ public class TestRawTransfer {
out.write(DataHelper.getASCII(send)); out.write(DataHelper.getASCII(send));
line = reader.readLine(); line = reader.readLine();
try { try {
tok = new StringTokenizer(line); props = SAMUtils.parseParams(line);
maj = tok.nextToken();
min = tok.nextToken();
props = SAMUtils.parseParams(tok);
} catch (Exception e) { } catch (Exception e) {
_log.error("Error parsing response line: [" + line + "]", e); _log.error("Error parsing response line: [" + line + "]", e);
return; return;
......
...@@ -75,10 +75,7 @@ public class TestStreamTransfer { ...@@ -75,10 +75,7 @@ public class TestStreamTransfer {
req = "NAMING LOOKUP NAME=ME\n"; req = "NAMING LOOKUP NAME=ME\n";
out.write(DataHelper.getASCII(req)); out.write(DataHelper.getASCII(req));
line = reader.readLine(); line = reader.readLine();
StringTokenizer tok = new StringTokenizer(line); Properties props = SAMUtils.parseParams(line);
String maj = tok.nextToken();
String min = tok.nextToken();
Properties props = SAMUtils.parseParams(tok);
String value = props.getProperty("VALUE"); String value = props.getProperty("VALUE");
if (value == null) { if (value == null) {
_log.error("No value for ME found! [" + line + "]"); _log.error("No value for ME found! [" + line + "]");
...@@ -124,10 +121,9 @@ public class TestStreamTransfer { ...@@ -124,10 +121,9 @@ public class TestStreamTransfer {
private void doRun() throws IOException, SAMException { private void doRun() throws IOException, SAMException {
String line = _reader.readLine(); String line = _reader.readLine();
_log.debug("Read: " + line); _log.debug("Read: " + line);
StringTokenizer tok = new StringTokenizer(line); Properties props = SAMUtils.parseParams(line);
String maj = tok.nextToken(); String maj = props.getProperty(SAMUtils.COMMAND);
String min = tok.nextToken(); String min = props.getProperty(SAMUtils.OPCODE);
Properties props = SAMUtils.parseParams(tok);
if ( ("STREAM".equals(maj)) && ("CONNECTED".equals(min)) ) { if ( ("STREAM".equals(maj)) && ("CONNECTED".equals(min)) ) {
String dest = props.getProperty("DESTINATION"); String dest = props.getProperty("DESTINATION");
String id = props.getProperty("ID"); String id = props.getProperty("ID");
...@@ -225,10 +221,7 @@ public class TestStreamTransfer { ...@@ -225,10 +221,7 @@ public class TestStreamTransfer {
out.write(DataHelper.getASCII(req)); out.write(DataHelper.getASCII(req));
line = reader.readLine(); line = reader.readLine();
_log.info("Response to the stream connect from "+sessionName+" to Alice: " + line); _log.info("Response to the stream connect from "+sessionName+" to Alice: " + line);
StringTokenizer tok = new StringTokenizer(line); Properties props = SAMUtils.parseParams(line);
String maj = tok.nextToken();
String min = tok.nextToken();
Properties props = SAMUtils.parseParams(tok);
_log.info("props = " + props); _log.info("props = " + props);
String result = props.getProperty("RESULT"); String result = props.getProperty("RESULT");
if (!("OK".equals(result))) { if (!("OK".equals(result))) {
......
...@@ -143,15 +143,15 @@ public class TestSwarm { ...@@ -143,15 +143,15 @@ public class TestSwarm {
_samOut.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n")); _samOut.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
_samOut.flush(); _samOut.flush();
_log.debug("Hello sent"); _log.debug("Hello sent");
boolean ok = _eventHandler.waitForHelloReply(); String serverVersion = _eventHandler.waitForHelloReply();
_log.debug("Hello reply found: " + ok); _log.debug("Hello reply found: " + serverVersion);
if (!ok) if (serverVersion == null)
throw new IOException("wtf, hello failed?"); throw new IOException("wtf, hello failed?");
String req = "SESSION CREATE STYLE=STREAM DESTINATION=" + _destFile + " " + _conOptions + "\n"; String req = "SESSION CREATE STYLE=STREAM DESTINATION=" + _destFile + " " + _conOptions + "\n";
_samOut.write(DataHelper.getUTF8(req)); _samOut.write(DataHelper.getUTF8(req));
_samOut.flush(); _samOut.flush();
_log.debug("Session create sent"); _log.debug("Session create sent");
ok = _eventHandler.waitForSessionCreateReply(); boolean ok = _eventHandler.waitForSessionCreateReply();
_log.debug("Session create reply found: " + ok); _log.debug("Session create reply found: " + ok);
req = "NAMING LOOKUP NAME=ME\n"; req = "NAMING LOOKUP NAME=ME\n";
......
...@@ -1492,7 +1492,7 @@ public class BlockfileNamingService extends DummyNamingService { ...@@ -1492,7 +1492,7 @@ public class BlockfileNamingService extends DummyNamingService {
rv = lookupAll2(hostname, lookupOptions, storedOptions); rv = lookupAll2(hostname, lookupOptions, storedOptions);
} }
} }
// we sort the destinations in addDestionation(), // we sort the destinations in addDestination(),
// which is a lot easier than sorting them here // which is a lot easier than sorting them here
return rv; return rv;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment