From 5248db43804d0ca17d916e59c2a2fa8eca51a559 Mon Sep 17 00:00:00 2001 From: Greg Alexander Date: Tue, 16 Dec 2014 18:20:01 -0500 Subject: [PATCH] add a (useless) service onDestroy() to clean up the sshd --- src/org/galexander/sshd/SimpleSSHDService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/org/galexander/sshd/SimpleSSHDService.java b/src/org/galexander/sshd/SimpleSSHDService.java index 9aacf10..2b600d4 100644 --- a/src/org/galexander/sshd/SimpleSSHDService.java +++ b/src/org/galexander/sshd/SimpleSSHDService.java @@ -26,10 +26,21 @@ public class SimpleSSHDService extends Service { return START_NOT_STICKY; } } + public IBinder onBind(Intent intent) { return null; } + /* unfortunately, android doesn't reliably call this when, i.e., + * the package is upgraded... so it's really pretty useless */ + public void onDestroy() { + if (is_started()) { + stop_sshd(); + } + stopSelf(); + super.onDestroy(); + } + public static boolean is_started() { return (sshd_pid != 0); }