Skip to content

Commit

Permalink
[Bug] find free port method called multiple times (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmod committed Jul 16, 2019
1 parent 1cf6eb6 commit d2cf7f2
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ class WebServerService : Service() {
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
MyLog.i("onStartCommand")
startForeground(NOTIFICATION_ID, createNotification())
val port = findFreePort()
intent?.getParcelableExtra<ShareRequest>(EXTRA_REQUEST)?.let { request ->
webServer?.stop()
stopper?.cancel()
val port = findFreePort()
webServer = when (request) {
is ShareRequest.ShareRequestText -> get<WebServerText>(parameters = { parametersOf(port) }).apply {
setText(
Expand Down

0 comments on commit d2cf7f2

Please sign in to comment.