aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2011-05-12 18:00:27 +0200
committerHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2011-05-12 18:07:43 +0200
commit097df1246e0f5e3f03bf0495ddd776cfe1943395 (patch)
treee53c5abaf85563979d5205287e81b7b4373c6399 /src
parentee03eba64ee9ed1fc744b528f99ed218f6cc1ee0 (diff)
downloadBlueGPS-097df1246e0f5e3f03bf0495ddd776cfe1943395.zip
BlueGPS-097df1246e0f5e3f03bf0495ddd776cfe1943395.tar.gz
BlueGPS-097df1246e0f5e3f03bf0495ddd776cfe1943395.tar.bz2
update (and improve ? ) disable and socket closing process.
Diffstat (limited to 'src')
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
index bfdb0cf..a199099 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
@@ -338,7 +338,7 @@ public class BlueetoothGpsManager {
if (connectedGps != null){
connectedGps.close();
}
- if (gpsSocket != null){
+ if ((gpsSocket != null) && ((connectedGps == null) || (connectedGps.socket != gpsSocket))){
Log.d(LOG_TAG, "trying to close old socket");
gpsSocket.close();
}
@@ -488,10 +488,11 @@ public class BlueetoothGpsManager {
e.printStackTrace();
}
if (!connectionAndReadingPool.isTerminated()){
+ connectionAndReadingPool.shutdownNow();
if (connectedGps != null){
connectedGps.close();
}
- if (gpsSocket != null){
+ if ((gpsSocket != null) && ((connectedGps == null) || (connectedGps.socket != gpsSocket))){
try {
Log.d(LOG_TAG, "closing Bluetooth GPS socket");
gpsSocket.close();
@@ -499,7 +500,6 @@ public class BlueetoothGpsManager {
Log.e(LOG_TAG, "error while closing socket", closeException);
}
}
- connectionAndReadingPool.shutdownNow();
}
}
};