mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-08 15:12:40 +01:00
Fix CPU waste in EngineServer
This commit is contained in:
@@ -149,8 +149,8 @@ public class PortListener {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
byte[] buffer = new byte[4096];
|
||||||
while (true) {
|
while (true) {
|
||||||
byte[] buffer = new byte[4096];
|
|
||||||
int len = is.read(buffer);
|
int len = is.read(buffer);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
break;
|
break;
|
||||||
@@ -174,13 +174,11 @@ public class PortListener {
|
|||||||
shutDownFlag = true;
|
shutDownFlag = true;
|
||||||
thread.interrupt();
|
thread.interrupt();
|
||||||
ServerSocket ss = serverSocket;
|
ServerSocket ss = serverSocket;
|
||||||
if (ss != null) {
|
if (ss != null)
|
||||||
close(ss);
|
close(ss);
|
||||||
}
|
|
||||||
Socket s = clientSocket;
|
Socket s = clientSocket;
|
||||||
if (s != null) {
|
if (s != null)
|
||||||
close(s);
|
close(s);
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
thread.join();
|
thread.join();
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user