Skip to content

Commit

Permalink
0.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Immueggpain authored and Immueggpain committed Dec 28, 2019
1 parent 8d1da95 commit 327acec
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.github.immueggpain</groupId>
<artifactId>simple-streaming</artifactId>
<version>0.0.6</version>
<version>0.0.7</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
subcommands = { HelpCommand.class, StreamUpload.class, StreamServer.class, Serve.class })
public class Launcher implements Callable<Void> {

public static final String VERSTR = "0.0.6";
public static final String VERSTR = "0.0.7";
public static final int LOCAL_PORT = 2233;
public static final int LOCAL_OVPN_PORT = 1194;
public static final int BUFLEN = 1024 * 16;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,23 @@ private void upload_thread(Socket socket) {
InputStream is = socket.getInputStream();
byte[] buf = new byte[Launcher.BUFLEN];

int len = is.read(buf);
if (len == -1)
return;

synchronized (activeDownloaders) {
for (Downloader downloader : activeDownloaders.values()) {
if (downloader.buflen == 0) {
System.arraycopy(buf, 0, downloader.buf, 0, len);
downloader.buflen = len;
while (true) {
int len = is.read(buf);
if (len == -1)
return;

synchronized (activeDownloaders) {
for (Downloader downloader : activeDownloaders.values()) {
if (downloader.buflen == 0) {
System.arraycopy(buf, 0, downloader.buf, 0, len);
downloader.buflen = len;
System.out.println("copied");
} else {
System.out.println("skiped");
}
}
}
}

socket.close();
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private static long copyLarge(final RandomAccessFile input, final OutputStream o
int n;
while (-1 != (n = input.read(buffer))) {
output.write(buffer, 0, n);
System.out.println("sent " + n);
}
return input.getFilePointer();
}
Expand Down

0 comments on commit 327acec

Please sign in to comment.