Make synchronization more consistent.
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 22 May 2009 05:10:33 +0000 (07:10 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 22 May 2009 05:10:33 +0000 (07:10 +0200)
src/net/pterodactylus/fcp/FcpConnection.java

index a80c610..e9db700 100644 (file)
@@ -359,7 +359,7 @@ public class FcpConnection implements Closeable {
         *            The length of the stream
         * @return The limited input stream
         */
-       private LimitedInputStream getInputStream(long dataLength) {
+       private synchronized LimitedInputStream getInputStream(long dataLength) {
                if (dataLength <= 0) {
                        return new LimitedInputStream(null, 0);
                }
@@ -482,7 +482,7 @@ public class FcpConnection implements Closeable {
                 * @throws IOException
                 *             if an I/O error occurs
                 */
-               public void consume() throws IOException {
+               public synchronized void consume() throws IOException {
                        while (remaining > 0) {
                                skip(remaining);
                        }