mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: replace thread with coroutines
This commit is contained in:
parent
da28c2a3bc
commit
6f4a10e963
1 changed files with 2 additions and 4 deletions
|
|
@ -2,6 +2,7 @@ package com.geeksville.mesh.repository.radio
|
|||
|
||||
import android.content.Context
|
||||
import com.geeksville.mesh.android.Logging
|
||||
import com.geeksville.mesh.concurrent.handledLaunch
|
||||
import com.geeksville.mesh.repository.usb.UsbRepository
|
||||
import com.geeksville.mesh.util.Exceptions
|
||||
import java.io.BufferedOutputStream
|
||||
|
|
@ -11,8 +12,6 @@ import java.io.OutputStream
|
|||
import java.net.InetAddress
|
||||
import java.net.Socket
|
||||
import java.net.SocketTimeoutException
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
|
||||
class TCPInterface(service: RadioInterfaceService, private val address: String) :
|
||||
StreamInterface(service) {
|
||||
|
|
@ -59,8 +58,7 @@ class TCPInterface(service: RadioInterfaceService, private val address: String)
|
|||
}
|
||||
|
||||
override fun connect() {
|
||||
// No need to keep a reference to this thread - it will exit when we close inStream
|
||||
thread(start = true, isDaemon = true, name = "TCP reader") {
|
||||
service.serviceScope.handledLaunch {
|
||||
try {
|
||||
val a = InetAddress.getByName(address)
|
||||
debug("TCP connecting to $address")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue