i came in ur dad
parent
bc1aa49115
commit
8cf701d408
|
@ -28,23 +28,23 @@ public class ChunkedCompressedChecksumFileReader {
|
|||
}
|
||||
|
||||
public FileHeader readChunk(Tracer trace, Span sp) throws IOException {
|
||||
//Span gf = trace.spanBuilder("Chunk Read").setParent(Context.current().with(sp)).startSpan();
|
||||
Span gf = trace.spanBuilder("Chunk Read").setParent(Context.current().with(sp)).startSpan();
|
||||
FileHeader header = readHeader();
|
||||
//try (Scope scope = gf.makeCurrent()) {
|
||||
try (Scope scope = gf.makeCurrent()) {
|
||||
if (header.getUncompressed() == 0)
|
||||
return header;
|
||||
sp.addEvent("Read Data");
|
||||
gf.addEvent("Read Data");
|
||||
byte[] data = readSome(header);
|
||||
sp.addEvent("Decompress Data");
|
||||
gf.addEvent("Decompress Data");
|
||||
byte[] decompressed = decompress(header, data);
|
||||
sp.addEvent("Hash");
|
||||
gf.addEvent("Hash");
|
||||
hash(header, decompressed);
|
||||
sp.addEvent("Write");
|
||||
gf.addEvent("Write");
|
||||
fileOutputWriter.write(decompressed, 0, decompressed.length);
|
||||
sp.addEvent("End");
|
||||
// } finally {
|
||||
// gf.end();
|
||||
// }
|
||||
gf.addEvent("End");
|
||||
} finally {
|
||||
gf.end();
|
||||
}
|
||||
return header;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ public class Connection implements Runnable {
|
|||
try (Scope scope = fileSend.makeCurrent()) {
|
||||
int filesReceived = 0;
|
||||
while (server.isRunning()) {
|
||||
System.out.println("Hello " + clientSocket.isConnected());
|
||||
if (!clientSocket.isConnected()) {
|
||||
System.out.println("Client Disconnected");
|
||||
break;
|
||||
|
@ -78,6 +77,8 @@ public class Connection implements Runnable {
|
|||
in.close();
|
||||
clientSocket.close();
|
||||
} catch (Exception ignored) {}
|
||||
Server.running = false;
|
||||
Server.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class Server {
|
|||
|
||||
public static final int SERVER_PORT = 42069;
|
||||
|
||||
private volatile boolean running = true;
|
||||
public static volatile boolean running = true;
|
||||
|
||||
private static final OpenTelemetry ot = OTelUtils.create();
|
||||
|
||||
|
@ -67,8 +67,14 @@ public class Server {
|
|||
return running;
|
||||
}
|
||||
|
||||
private static Server srv;
|
||||
|
||||
public static void main(String[] args) {
|
||||
new Server();
|
||||
srv = new Server();
|
||||
}
|
||||
|
||||
public static void close(){
|
||||
srv.notifyAll();
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue