refine the exception handling

This commit is contained in:
Max Lv
2015-08-05 12:22:49 +08:00
parent de7e516204
commit 9a841e901c
@@ -123,6 +123,14 @@ class ShadowsocksVpnThread(vpnService: ShadowsocksVpnService) extends Thread {
} catch {
case e: IOException => {
Log.e(TAG, "Error when accept socket", e)
if (ShadowsocksVpn.serverSocket != null) {
try {
ShadowsocksVpn.serverSocket.close()
} catch {
case _: Exception => // ignore
}
ShadowsocksVpn.serverSocket = null
}
return
}
}