Skip to content

Commit 946e664

Browse files
Restore previous BSP socket cleanup logic and add comments
1 parent d7d5ec1 commit 946e664

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

frontend/src/main/scala/bloop/bsp/BspServer.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ object BspServer {
6262
): Task[State] = {
6363
val isCommunicationActive = Atomic(true)
6464
val connectionURI = handle.uri
65-
// Do NOT change this log, it's used by clients to know when to start a connection
65+
6666
logger.info(s"The server is listening for incoming connections at $connectionURI...")
6767
promiseWhenStarted.foreach(_.success(()))
6868

@@ -87,7 +87,7 @@ object BspServer {
8787
scheduler,
8888
ioScheduler
8989
)
90-
// In this case BloopLanguageServer doesn't use input observable
90+
9191
val server =
9292
new BloopLanguageServer(Observable.never, client, provider.services, ioScheduler, bspLogger)
9393

@@ -96,7 +96,7 @@ object BspServer {
9696
LowLevelMessage
9797
.fromInputStream(in, bspLogger)
9898
.guaranteeCase(_ => monix.eval.Task(inputExit.success(())))
99-
.asyncBoundary(OverflowStrategy.Unbounded) // allows to catch input stream close earlier
99+
.asyncBoundary(OverflowStrategy.Unbounded)
100100
.mapParallelUnordered(4) { bytes =>
101101
val msg = LowLevelMessage.toMsg(bytes)
102102
server
@@ -121,6 +121,8 @@ object BspServer {
121121
def askCurrentBspClients: Set[ClientInfo.BspClientInfo] = {
122122
import scala.collection.JavaConverters._
123123
val clients0 = connectedBspClients.keySet().asScala.toSet
124+
// Add client that will be removed from map always so that its
125+
// project directories are visited and orphan dirs pruned
124126
initializedClientInfo match {
125127
case Some(bspInfo) => clients0.+(bspInfo)
126128
case None => clients0
@@ -210,7 +212,6 @@ object BspServer {
210212
serverSocket: ServerSocket,
211213
socketPath: Option[Path] = None
212214
): Unit = {
213-
// Close any socket communication asap and swallow exceptions
214215
try {
215216
try socket.close()
216217
catch { case NonFatal(_) => () }
@@ -225,7 +226,6 @@ object BspServer {
225226
}
226227
}
227228
} finally {
228-
q// Guarantee that we always schedule the external classes directories deletion
229229
val deleteExternalDirsTasks = latestState.build.loadedProjects.map { loadedProject =>
230230
import bloop.io.Paths
231231
val project = loadedProject.project
@@ -252,4 +252,4 @@ object BspServer {
252252
()
253253
}
254254
}
255-
}
255+
}

0 commit comments

Comments
 (0)