Support specifying network interface

Fix #15.
This commit is contained in:
Mygod
2018-06-02 07:29:46 +08:00
parent 8e335fec1b
commit da9bf4867e
14 changed files with 326 additions and 173 deletions

View File

@@ -37,8 +37,6 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
val iface = ifaces.singleOrNull()
binder.iface = iface
if (iface == null) {
routingManager?.stop()
routingManager = null
unregisterReceiver()
ServiceNotification.stopForeground(this)
stopSelf()
@@ -103,6 +101,8 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
}
private fun unregisterReceiver() {
routingManager?.stop()
routingManager = null
if (receiverRegistered) {
unregisterReceiver(receiver)
IpNeighbourMonitor.unregisterCallback(this)