Use Future instead of Thread.
This commit is contained in:
parent
2a48c7bbcb
commit
6d95c8bb33
1 changed files with 5 additions and 7 deletions
|
@ -17,6 +17,8 @@ import com.nutomic.ensichat.util.Database
|
||||||
|
|
||||||
import scala.collection.SortedSet
|
import scala.collection.SortedSet
|
||||||
import scala.collection.immutable.{HashMap, HashSet, TreeSet}
|
import scala.collection.immutable.{HashMap, HashSet, TreeSet}
|
||||||
|
import scala.concurrent.Future
|
||||||
|
import scala.concurrent.ExecutionContext.Implicits.global
|
||||||
import scala.ref.WeakReference
|
import scala.ref.WeakReference
|
||||||
|
|
||||||
object ChatService {
|
object ChatService {
|
||||||
|
@ -94,13 +96,9 @@ class ChatService extends Service {
|
||||||
startBluetoothConnections()
|
startBluetoothConnections()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Crypto.localKeysExist) {
|
if (!Crypto.localKeysExist)
|
||||||
new Thread(new Runnable {
|
Future(Crypto.generateLocalKeys())
|
||||||
override def run(): Unit = {
|
else
|
||||||
Crypto.generateLocalKeys()
|
|
||||||
}
|
|
||||||
}).start()
|
|
||||||
} else
|
|
||||||
Log.i(Tag, "Service started, address is " + Crypto.getLocalAddress)
|
Log.i(Tag, "Service started, address is " + Crypto.getLocalAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue