projects
/
jSite.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix calculation of project size.
[jSite.git]
/
src
/
de
/
todesbaum
/
jsite
/
application
/
Freenet7Interface.java
diff --git
a/src/de/todesbaum/jsite/application/Freenet7Interface.java
b/src/de/todesbaum/jsite/application/Freenet7Interface.java
index
4c9d9c5
..
78250b2
100644
(file)
--- a/
src/de/todesbaum/jsite/application/Freenet7Interface.java
+++ b/
src/de/todesbaum/jsite/application/Freenet7Interface.java
@@
-1,6
+1,5
@@
/*
/*
- * jSite -
- * Copyright (C) 2006 David Roden
+ * jSite - Freenet7Interface.java - Copyright © 2006–2012 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-34,6
+33,9
@@
import de.todesbaum.util.freenet.fcp2.Node;
*/
public class Freenet7Interface {
*/
public class Freenet7Interface {
+ /** Random number to differentiate several jSites. */
+ private static final int number = (int) (Math.random() * Integer.MAX_VALUE);
+
/** Counter. */
private static int counter = 0;
/** Counter. */
private static int counter = 0;
@@
-44,15
+46,15
@@
public class Freenet7Interface {
private Connection connection;
/**
private Connection connection;
/**
- * Sets the hostname of the node. The default port for FCP2 connections (
- *
{@link Node#DEFAULT_PORT})
is used.
+ * Sets the hostname of the node. The default port for FCP2 connections (
{@link Node#DEFAULT_PORT})
+ * is used.
*
* @param hostname
* The hostname of the node
*/
public void setNodeAddress(String hostname) {
node = new Node(hostname);
*
* @param hostname
* The hostname of the node
*/
public void setNodeAddress(String hostname) {
node = new Node(hostname);
- connection = new Connection(node, "connection-" + counter++);
+ connection = new Connection(node, "
jSite-" + number + "-
connection-" + counter++);
}
/**
}
/**
@@
-65,7
+67,7
@@
public class Freenet7Interface {
*/
public void setNodeAddress(String hostname, int port) {
node = new Node(hostname, port);
*/
public void setNodeAddress(String hostname, int port) {
node = new Node(hostname, port);
- connection = new Connection(node, "connection-" + counter++);
+ connection = new Connection(node, "
jSite-" + number + "-
connection-" + counter++);
}
/**
}
/**
@@
-77,7
+79,7
@@
public class Freenet7Interface {
public void setNode(de.todesbaum.jsite.application.Node node) {
if (node != null) {
this.node = new Node(node.getHostname(), node.getPort());
public void setNode(de.todesbaum.jsite.application.Node node) {
if (node != null) {
this.node = new Node(node.getHostname(), node.getPort());
- connection = new Connection(node, "connection-" + counter++);
+ connection = new Connection(node, "
jSite-" + number + "-
connection-" + counter++);
} else {
this.node = null;
connection = null;
} else {
this.node = null;
connection = null;
@@
-139,7
+141,7
@@
public class Freenet7Interface {
*/
public String[] generateKeyPair() throws IOException {
if (!isNodePresent()) {
*/
public String[] generateKeyPair() throws IOException {
if (!isNodePresent()) {
-
return null
;
+
throw new IOException("Node is offline.")
;
}
GenerateSSK generateSSK = new GenerateSSK();
Client client = new Client(connection, generateSSK);
}
GenerateSSK generateSSK = new GenerateSSK();
Client client = new Client(connection, generateSSK);