Merge pull request #5832 from eatkins/tcp-socket

Catch SocketException on server shutdown
This commit is contained in:
eugene yokota 2020-09-10 17:21:07 -04:00 committed by GitHub
commit 1514f96492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -10,7 +10,7 @@ package internal
package server package server
import java.io.{ File, IOException } import java.io.{ File, IOException }
import java.net.{ InetAddress, ServerSocket, Socket, SocketTimeoutException } import java.net.{ InetAddress, ServerSocket, Socket, SocketException, SocketTimeoutException }
import java.util.concurrent.atomic.{ AtomicBoolean, AtomicReference } import java.util.concurrent.atomic.{ AtomicBoolean, AtomicReference }
import java.nio.file.attribute.{ AclEntry, AclEntryPermission, AclEntryType, UserPrincipal } import java.nio.file.attribute.{ AclEntry, AclEntryPermission, AclEntryType, UserPrincipal }
import java.security.SecureRandom import java.security.SecureRandom
@ -110,6 +110,7 @@ private[sbt] object Server {
} catch { } catch {
case e: IOException if e.getMessage.contains("connect") => case e: IOException if e.getMessage.contains("connect") =>
case _: SocketTimeoutException => // its ok case _: SocketTimeoutException => // its ok
case _: SocketException if !running.get => // the server is shutting down
} }
} }
serverSocketHolder.get match { serverSocketHolder.get match {

View File

@ -36,6 +36,7 @@ object LintUnused {
onLoadMessage, onLoadMessage,
onUnload, onUnload,
sbt.nio.Keys.watchTriggers, sbt.nio.Keys.watchTriggers,
serverConnectionType,
), ),
includeLintKeys := Set( includeLintKeys := Set(
scalacOptions, scalacOptions,