Changed stop() to dispose() on crash, fixed web key triggers
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="io.anuke.mindustry"
|
package="io.anuke.mindustry"
|
||||||
android:versionCode="58"
|
android:versionCode="59"
|
||||||
android:versionName="3.3b9" >
|
android:versionName="3.3b10" >
|
||||||
|
|
||||||
<uses-permission android:name="com.android.vending.BILLING" />
|
<uses-permission android:name="com.android.vending.BILLING" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|||||||
@@ -136,8 +136,7 @@ public class DesktopLauncher {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
//attempt to close connections
|
//attempt to close connections
|
||||||
try{ Net.closeServer(); }catch (Exception p){}
|
try{ Net.dispose(); }catch (Exception p){}
|
||||||
try{ Net.disconnect(); }catch (Exception p){}
|
|
||||||
|
|
||||||
//don't create crash logs for me (anuke), as it's expected
|
//don't create crash logs for me (anuke), as it's expected
|
||||||
if(System.getProperty("user.name").equals("anuke")) return;
|
if(System.getProperty("user.name").equals("anuke")) return;
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
<script type="text/javascript" src="html/html.nocache.js"></script>
|
<script type="text/javascript" src="html/html.nocache.js"></script>
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
|
var keys = [27, 38, 37, 39, 40, 17, 9];
|
||||||
|
|
||||||
function handleMouseDown(evt) {
|
function handleMouseDown(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
@@ -28,8 +30,8 @@
|
|||||||
|
|
||||||
|
|
||||||
function preventUseOfDefaultKeys(event) {
|
function preventUseOfDefaultKeys(event) {
|
||||||
if (event.keyCode == 32 || event.keyCode == 27 || event.keyCode == 38 || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 40 || event.keyCode == 17){
|
if (keys.indexOf(event.keyCode) != -1 || event.ctrlKey){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import io.anuke.mindustry.net.Streamable.StreamChunk;
|
|||||||
import io.anuke.ucore.UCore;
|
import io.anuke.ucore.UCore;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import org.java_websocket.WebSocket;
|
import org.java_websocket.WebSocket;
|
||||||
|
import org.java_websocket.exceptions.WebsocketNotConnectedException;
|
||||||
import org.java_websocket.handshake.ClientHandshake;
|
import org.java_websocket.handshake.ClientHandshake;
|
||||||
import org.java_websocket.server.WebSocketServer;
|
import org.java_websocket.server.WebSocketServer;
|
||||||
|
|
||||||
@@ -259,7 +260,13 @@ public class KryoServer implements ServerProvider {
|
|||||||
public void dispose(){
|
public void dispose(){
|
||||||
try {
|
try {
|
||||||
server.dispose();
|
server.dispose();
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
UCore.log("Disposing web server...");
|
UCore.log("Disposing web server...");
|
||||||
|
|
||||||
if(webServer != null) webServer.stop(1);
|
if(webServer != null) webServer.stop(1);
|
||||||
//kill them all
|
//kill them all
|
||||||
for(Thread thread : Thread.getAllStackTraces().keySet()){
|
for(Thread thread : Thread.getAllStackTraces().keySet()){
|
||||||
@@ -269,7 +276,7 @@ public class KryoServer implements ServerProvider {
|
|||||||
}
|
}
|
||||||
UCore.log("Killed web server.");
|
UCore.log("Killed web server.");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
throw new RuntimeException(e);
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,9 +349,12 @@ public class KryoServer implements ServerProvider {
|
|||||||
if(debug) UCore.log("Sending string: " + string);
|
if(debug) UCore.log("Sending string: " + string);
|
||||||
socket.send(string);
|
socket.send(string);
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (WebsocketNotConnectedException e){
|
||||||
e.printStackTrace();
|
//don't log anything, it's not important
|
||||||
connections.remove(this);
|
connections.remove(this);
|
||||||
|
}catch (Exception e){
|
||||||
|
connections.remove(this);
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}else if (connection != null) {
|
}else if (connection != null) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user