abort tracking if tcp connection fails

itemized2sql
Georg Lukas 2010-08-22 22:49:53 +02:00
rodzic bff3bd84ee
commit 597e811229
2 zmienionych plików z 12 dodań i 1 usunięć

Wyświetl plik

@ -209,5 +209,12 @@ class AprsService extends Service with LocationListener {
def postSubmit(post : String) {
handler.post { addPost(StorageDatabase.Post.TYPE_INCMG, "incoming", post) }
}
def postAbort(post : String) {
handler.post {
addPost(StorageDatabase.Post.TYPE_ERROR, "Error", post)
stopSelf()
}
}
}

Wyświetl plik

@ -63,7 +63,11 @@ class TcpUploader(service : AprsService, hostname : String, login : String, filt
override def run() {
Log.d(TAG, "TcpSocketThread.run()")
catchLog("init_socket", init_socket)
try {
init_socket()
} catch {
case e : Exception => service.postAbort(e.getMessage())
}
while (running) {
try {
Log.d(TAG, "waiting for data...")