mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-27 06:10:28 +01:00
DroidFish: Don't do network communication on main thread.
This commit is contained in:
parent
b8aaa215d3
commit
9480603ddb
|
@ -264,6 +264,7 @@ public class ExternalEngine extends UCIEngineBase {
|
|||
return ret;
|
||||
}
|
||||
|
||||
// FIXME!! Writes should be handled by separate thread.
|
||||
/** @inheritDoc */
|
||||
@Override
|
||||
public void writeLineToEngine(String data) {
|
||||
|
|
|
@ -158,7 +158,6 @@ public class NetworkEngine extends UCIEngineBase {
|
|||
else
|
||||
report.reportError(context.getString(R.string.engine_terminated));
|
||||
}
|
||||
try { socket.close(); } catch (IOException e) {}
|
||||
}
|
||||
engineToGui.close();
|
||||
}
|
||||
|
@ -189,6 +188,7 @@ public class NetworkEngine extends UCIEngineBase {
|
|||
report.reportError(context.getString(R.string.engine_terminated));
|
||||
}
|
||||
isRunning = false;
|
||||
try { socket.getOutputStream().write("quit\n".getBytes()); } catch (IOException e) {}
|
||||
try { socket.close(); } catch (IOException ex) {}
|
||||
}
|
||||
}
|
||||
|
@ -267,10 +267,6 @@ public class NetworkEngine extends UCIEngineBase {
|
|||
isRunning = false;
|
||||
if (startupThread != null)
|
||||
startupThread.interrupt();
|
||||
if (socket != null) {
|
||||
try { socket.getOutputStream().write("quit\n".getBytes()); } catch (IOException e) {}
|
||||
try { socket.close(); } catch (IOException e) {}
|
||||
}
|
||||
super.shutDown();
|
||||
if (stdOutThread != null)
|
||||
stdOutThread.interrupt();
|
||||
|
|
|
@ -64,7 +64,6 @@ public interface UCIEngine {
|
|||
*/
|
||||
String readLineFromEngine(int timeoutMillis);
|
||||
|
||||
// FIXME!! Writes should be handled by separate thread.
|
||||
/** Write a line to the engine. \n will be added automatically. */
|
||||
void writeLineToEngine(String data);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user