mirror of https://github.com/sbt/sbt.git
Merge pull request #8005 from dwickern/fix-npe
Fix race condition in NetworkChannel
This commit is contained in:
commit
d99163b945
|
|
@ -163,7 +163,7 @@ final class NetworkChannel(
|
|||
}
|
||||
}
|
||||
|
||||
val thread = new Thread(s"sbt-networkchannel-${connection.getPort}") {
|
||||
private[this] val thread = new Thread(s"sbt-networkchannel-${connection.getPort}") {
|
||||
private val ct = "Content-Type: "
|
||||
private val x1 = "application/sbt-x1"
|
||||
override def run(): Unit = {
|
||||
|
|
@ -241,7 +241,6 @@ final class NetworkChannel(
|
|||
}
|
||||
}
|
||||
}
|
||||
thread.start()
|
||||
|
||||
private[sbt] def isLanguageServerProtocol: Boolean = true
|
||||
|
||||
|
|
@ -365,7 +364,6 @@ final class NetworkChannel(
|
|||
impl()
|
||||
}, s"sbt-$name-write-thread")
|
||||
writeThread.setDaemon(true)
|
||||
writeThread.start()
|
||||
|
||||
def publishBytes(event: Array[Byte], delimit: Boolean): Unit =
|
||||
try pendingWrites.put(event -> delimit)
|
||||
|
|
@ -914,6 +912,9 @@ final class NetworkChannel(
|
|||
}
|
||||
}
|
||||
private[sbt] def isAttached: Boolean = attached.get
|
||||
|
||||
thread.start()
|
||||
writeThread.start()
|
||||
}
|
||||
|
||||
object NetworkChannel {
|
||||
|
|
|
|||
Loading…
Reference in New Issue