diff options
author | Herbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com> | 2011-05-12 18:00:27 +0200 |
---|---|---|
committer | Herbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com> | 2011-05-12 18:07:43 +0200 |
commit | 097df1246e0f5e3f03bf0495ddd776cfe1943395 (patch) | |
tree | e53c5abaf85563979d5205287e81b7b4373c6399 /src/org | |
parent | ee03eba64ee9ed1fc744b528f99ed218f6cc1ee0 (diff) | |
download | BlueGPS-097df1246e0f5e3f03bf0495ddd776cfe1943395.zip BlueGPS-097df1246e0f5e3f03bf0495ddd776cfe1943395.tar.gz BlueGPS-097df1246e0f5e3f03bf0495ddd776cfe1943395.tar.bz2 |
update (and improve ? ) disable and socket closing process.
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java | 6 |
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();
}
}
};
|