mirror of
https://github.com/revanced/jadb.git
synced 2025-05-18 23:17:05 +02:00
Refactor: Better names
- serverReady and waitForServer had inverted names for some reason.
This commit is contained in:
parent
2073817c95
commit
24348f806d
@ -22,7 +22,7 @@ public abstract class SocketServer implements Runnable {
|
|||||||
thread = new Thread(this, "Fake Adb Server");
|
thread = new Thread(this, "Fake Adb Server");
|
||||||
thread.setDaemon(true);
|
thread.setDaemon(true);
|
||||||
thread.start();
|
thread.start();
|
||||||
serverReady();
|
waitForServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPort() {
|
public int getPort() {
|
||||||
@ -35,7 +35,7 @@ public abstract class SocketServer implements Runnable {
|
|||||||
socket = new ServerSocket(port);
|
socket = new ServerSocket(port);
|
||||||
socket.setReuseAddress(true);
|
socket.setReuseAddress(true);
|
||||||
|
|
||||||
waitForServer();
|
serverReady();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
Socket c = socket.accept();
|
Socket c = socket.accept();
|
||||||
@ -47,7 +47,14 @@ public abstract class SocketServer implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void serverReady() throws InterruptedException {
|
private void serverReady() {
|
||||||
|
synchronized (lockObject) {
|
||||||
|
isStarted = true;
|
||||||
|
lockObject.notify();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void waitForServer() throws InterruptedException {
|
||||||
synchronized (lockObject) {
|
synchronized (lockObject) {
|
||||||
if (!isStarted) {
|
if (!isStarted) {
|
||||||
lockObject.wait();
|
lockObject.wait();
|
||||||
@ -55,13 +62,6 @@ public abstract class SocketServer implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitForServer() {
|
|
||||||
synchronized (lockObject) {
|
|
||||||
lockObject.notify();
|
|
||||||
isStarted = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract Runnable createResponder(Socket socket);
|
protected abstract Runnable createResponder(Socket socket);
|
||||||
|
|
||||||
public void stop() throws IOException, InterruptedException {
|
public void stop() throws IOException, InterruptedException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user