mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-01-10 06:27:59 -05:00
Merge remote-tracking branch 'origin/GP-2441_ghidra1_BlockStreamServerCleanup'
This commit is contained in:
@@ -17,8 +17,7 @@ package ghidra.server.stream;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -167,10 +166,11 @@ public class BlockStreamServer extends Thread {
|
||||
*/
|
||||
private void cleanupStaleRequests(boolean cleanupAll) {
|
||||
synchronized (blockStreamMap) {
|
||||
List<Long> staleStreamIds = new ArrayList<>();
|
||||
for (BlockStreamRegistration registration : blockStreamMap.values()) {
|
||||
long age = System.currentTimeMillis() - registration.timestamp;
|
||||
if (age > MAX_AGE_MS) {
|
||||
blockStreamMap.remove(registration.streamHandle.getStreamID());
|
||||
staleStreamIds.add(registration.streamHandle.getStreamID());
|
||||
try {
|
||||
registration.blockStream.close();
|
||||
}
|
||||
@@ -179,6 +179,9 @@ public class BlockStreamServer extends Thread {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (long id : staleStreamIds) {
|
||||
blockStreamMap.remove(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +190,7 @@ public class BlockStreamServer extends Thread {
|
||||
* this method will return immediately.
|
||||
* @param s server socket to be used for accepting connections
|
||||
* @param host remote access hostname to be used by clients
|
||||
* @throws IOException
|
||||
* @throws IOException if an IO error occurs
|
||||
*/
|
||||
public synchronized void startServer(ServerSocket s, String host) throws IOException {
|
||||
|
||||
@@ -348,7 +351,7 @@ public class BlockStreamServer extends Thread {
|
||||
* Read the stream request header which must be the first input
|
||||
* received from the client.
|
||||
* @return StreamRequest data presented by client
|
||||
* @throws IOException
|
||||
* @throws IOException if an IO error occurs
|
||||
*/
|
||||
private StreamRequest readStreamRequest() throws IOException {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user