projects
/
jSite.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add “reset edition” button
[jSite.git]
/
src
/
de
/
todesbaum
/
util
/
freenet
/
fcp2
/
Connection.java
diff --git
a/src/de/todesbaum/util/freenet/fcp2/Connection.java
b/src/de/todesbaum/util/freenet/fcp2/Connection.java
index
15757d0
..
9932d25
100644
(file)
--- a/
src/de/todesbaum/util/freenet/fcp2/Connection.java
+++ b/
src/de/todesbaum/util/freenet/fcp2/Connection.java
@@
-31,6
+31,7
@@
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
+import de.todesbaum.util.io.Closer;
import de.todesbaum.util.io.LineInputStream;
import de.todesbaum.util.io.StreamCopier;
import de.todesbaum.util.io.TempFileInputStream;
import de.todesbaum.util.io.LineInputStream;
import de.todesbaum.util.io.StreamCopier;
import de.todesbaum.util.io.TempFileInputStream;
@@
-39,7
+40,7
@@
import de.todesbaum.util.io.TempFileInputStream;
* A physical connection to a Freenet node.
*
* @author David Roden <droden@gmail.com>
* A physical connection to a Freenet node.
*
* @author David Roden <droden@gmail.com>
- * @version $Id
: Connection.java 413 2006-03-29 12:22:31Z bombe
$
+ * @version $Id$
*/
public class Connection {
*/
public class Connection {
@@
-155,9
+156,6
@@
public class Connection {
nodeSocket.setReceiveBufferSize(65535);
nodeInputStream = nodeSocket.getInputStream();
nodeOutputStream = nodeSocket.getOutputStream();
nodeSocket.setReceiveBufferSize(65535);
nodeInputStream = nodeSocket.getInputStream();
nodeOutputStream = nodeSocket.getOutputStream();
- // nodeWriter = new TeeWriter(new
- // OutputStreamWriter(nodeOutputStream, Charset.forName("UTF-8")),
- // new PrintWriter(System.out));
nodeWriter = new OutputStreamWriter(nodeOutputStream, Charset.forName("UTF-8"));
nodeReader = new NodeReader(nodeInputStream);
Thread nodeReaderThread = new Thread(nodeReader);
nodeWriter = new OutputStreamWriter(nodeOutputStream, Charset.forName("UTF-8"));
nodeReader = new NodeReader(nodeInputStream);
Thread nodeReaderThread = new Thread(nodeReader);
@@
-231,6
+229,9
@@
public class Connection {
}
nodeSocket = null;
}
}
nodeSocket = null;
}
+ synchronized (this) {
+ notify();
+ }
fireConnectionTerminated();
}
fireConnectionTerminated();
}
@@
-253,7
+254,13
@@
public class Connection {
nodeWriter.write("EndMessage" + Command.LINEFEED);
nodeWriter.flush();
if (command.hasPayload()) {
nodeWriter.write("EndMessage" + Command.LINEFEED);
nodeWriter.flush();
if (command.hasPayload()) {
- StreamCopier.copy(command.getPayload(), nodeOutputStream, command.getPayloadLength());
+ InputStream payloadInputStream = null;
+ try {
+ payloadInputStream = command.getPayload();
+ StreamCopier.copy(payloadInputStream, nodeOutputStream, command.getPayloadLength());
+ } finally {
+ Closer.close(payloadInputStream);
+ }
nodeOutputStream.flush();
}
}
nodeOutputStream.flush();
}
}
@@
-264,7
+271,7
@@
public class Connection {
* listeners about the messages.
*
* @author David Roden <droden@gmail.com>
* listeners about the messages.
*
* @author David Roden <droden@gmail.com>
- * @version $Id
: Connection.java 413 2006-03-29 12:22:31Z bombe
$
+ * @version $Id$
*/
private class NodeReader implements Runnable {
*/
private class NodeReader implements Runnable {