Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt-core to 3.0.8 #574

Merged
merged 2 commits into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.0.7
version = 3.0.8

style = default

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private[nio1] final class NIO1HeadStage(
}
}

/// channel reading bits //////////////////////////////////////////////
// / channel reading bits //////////////////////////////////////////////

final override def readRequest(size: Int): Future[ByteBuffer] = {
logger.trace(s"NIOHeadStage received a read request of size $size")
Expand Down Expand Up @@ -234,7 +234,7 @@ private[nio1] final class NIO1HeadStage(
p.future
}

/// channel write bits /////////////////////////////////////////////////
// / channel write bits /////////////////////////////////////////////////

final override def writeRequest(data: ByteBuffer): Future[Unit] =
writeRequest(data :: Nil)
Expand Down Expand Up @@ -285,7 +285,7 @@ private[nio1] final class NIO1HeadStage(
p.future
}

///////////////////////////////// Channel Ops ////////////////////////////////////////
// /////////////////////////////// Channel Ops ////////////////////////////////////////

final override def close(cause: Option[Throwable]): Unit = doClosePipeline(cause)

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/org/http4s/blaze/pipeline/Stages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ sealed trait Tail[I] extends Stage {
p.future
} else f

///////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////
/** Schedules a timeout and sets it to race against the provided future
* @param p
* Promise[T] to be completed by whichever comes first: the timeout or resolution of the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ trait ByteToObjectStage[O] extends MidStage[ByteBuffer, O] {

private var _decodeBuffer: ByteBuffer = null

/////////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems weird 😑
Perhaps we should remove that comments at all.


/** Encode objects to buffers
* @param in
Expand All @@ -55,7 +55,7 @@ trait ByteToObjectStage[O] extends MidStage[ByteBuffer, O] {

val maxBufferSize: Int

/////////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////

override def writeRequest(data: collection.Seq[O]): Future[Unit] =
try channelWrite(data.flatMap(messageToBuffer))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import scala.concurrent.duration.Duration
/** Shut down the pipeline after a period of inactivity */
class QuietTimeoutStage[T](timeout: Duration, exec: TickWheelExecutor = scheduler)
extends TimeoutStageBase[T](timeout, exec) {
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////

override protected def stageStartup(): Unit = {
super.stageStartup()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,20 @@ final class SSLStage(engine: SSLEngine, maxWrite: Int = 1024 * 1024)
engine.closeOutbound()
} catch {
case e: SSLException =>
//Ignore cleanup errors. Example: With JDK SSLContextImpl, if the connection is closed before even handshake
//began(like port scanning), an SSLException might be thrown.
// Ignore cleanup errors. Example: With JDK SSLContextImpl, if the connection is closed before even handshake
// began(like port scanning), an SSLException might be thrown.
logger.debug(e)("Error while closing SSL Engine")
}

private[this] val maxNetSize = engine.getSession.getPacketBufferSize
private[this] val maxBuffer = math.max(maxNetSize, engine.getSession.getApplicationBufferSize)

///////////// State maintained by the SSLStage //////////////////////
// /////////// State maintained by the SSLStage //////////////////////
private[this] val handshakeQueue = new ListBuffer[DelayedOp]
private[this] var readLeftover: ByteBuffer = null
/////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////

override def writeRequest(data: collection.Seq[ByteBuffer]): Future[Unit] =
writeArray(data.toArray)
Expand All @@ -104,7 +104,7 @@ final class SSLStage(engine: SSLEngine, maxWrite: Int = 1024 * 1024)
p.future
}

/////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////

private[this] def writeArray(data: Array[ByteBuffer]): Future[Unit] = {
val p = Promise[Unit]()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class TimeoutStageBase[T](timeout: Duration, exec: TickWheelExecutor)

override def name: String = s"${this.getClass.getName} Stage: $timeout"

/////////// Private impl bits //////////////////////////////////////////
// ///////// Private impl bits //////////////////////////////////////////

private val lastTimeout =
new AtomicReference[Cancelable](Cancelable.NoopCancel)
Expand All @@ -56,15 +56,15 @@ abstract class TimeoutStageBase[T](timeout: Duration, exec: TickWheelExecutor)
} else prev.cancel()
}

/////////// Pass through implementations ////////////////////////////////
// ///////// Pass through implementations ////////////////////////////////

override def readRequest(size: Int): Future[T] = channelRead(size)

override def writeRequest(data: T): Future[Unit] = channelWrite(data)

override def writeRequest(data: collection.Seq[T]): Future[Unit] = channelWrite(data)

/////////// Protected impl bits //////////////////////////////////////////
// ///////// Protected impl bits //////////////////////////////////////////

override protected def stageShutdown(): Unit = {
setAndCancel(closedTag)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/org/http4s/blaze/util/TaskQueue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private[blaze] final class TaskQueue {
// If we are not the last cell, we will spin until the cons resolves and continue
if (!queueTail.compareAndSet(node, null))
go(spin(node))
//else () // Finished the last node. All done.
// else () // Finished the last node. All done.
} else go(next)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class TickWheelExecutor(wheelSize: Int = DefaultWheelSize, val tick: Duration =
private val clockFace: Array[Bucket] =
(0 until wheelSize).map(_ => new Bucket()).toArray

/////////////////////////////////////////////////////
// ///////////////////////////////////////////////////
// new Thread that actually runs the execution.

private val thread = new Thread(s"blaze-tick-wheel-executor") {
Expand All @@ -74,7 +74,7 @@ class TickWheelExecutor(wheelSize: Int = DefaultWheelSize, val tick: Duration =
thread.setDaemon(true)
thread.start()

/////////////////////////////////////////////////////
// ///////////////////////////////////////////////////

def shutdown(): Unit =
alive = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object ExampleKeystore {
*/

val ksStream =
getClass.getResourceAsStream("/clientauth/server.jks") //BogusKeystore.asInputStream()
getClass.getResourceAsStream("/clientauth/server.jks") // BogusKeystore.asInputStream()
assert(ksStream != null)

val ks = KeyStore.getInstance("JKS")
Expand Down
22 changes: 11 additions & 11 deletions http/src/main/scala/org/http4s/blaze/http/http2/FrameDecoder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener
Continue
}

//////////////// Decoding algorithms ///////////////////////////////////////////////////////////
// ////////////// Decoding algorithms ///////////////////////////////////////////////////////////

//////////// DATA ///////////////
// ////////// DATA ///////////////
// https://tools.ietf.org/html/rfc7540#section-6.1
private[this] def decodeDataFrame(buffer: ByteBuffer, streamId: Int, flags: Byte): Result =
if (streamId == 0)
Expand Down Expand Up @@ -143,7 +143,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener
listener.onDataFrame(streamId, Flags.END_STREAM(flags), buffer.slice(), flowBytes)
}

//////////// HEADERS ///////////////
// ////////// HEADERS ///////////////
private[this] def decodeHeaderFrame(buffer: ByteBuffer, streamId: Int, flags: Byte): Result =
if (streamId == 0)
Error(PROTOCOL_ERROR.goaway("Headers frame with stream id 0x0"))
Expand Down Expand Up @@ -174,7 +174,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener
}
}

//////////// PRIORITY ///////////////
// ////////// PRIORITY ///////////////
private[this] def decodePriorityFrame(buffer: ByteBuffer, streamId: Int): Result =
if (streamId == 0)
Error(PROTOCOL_ERROR.goaway("Priority frame with stream id 0x0"))
Expand All @@ -189,7 +189,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener
listener.onPriorityFrame(streamId, priority)
}

//////////// RST_STREAM ///////////////
// ////////// RST_STREAM ///////////////
private[this] def decodeRstStreamFrame(buffer: ByteBuffer, streamId: Int): Result =
if (streamId == 0)
Error(PROTOCOL_ERROR.goaway("RST_STREAM frame with stream id 0x0"))
Expand All @@ -201,7 +201,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener
listener.onRstStreamFrame(streamId, code)
}

//////////// SETTINGS ///////////////
// ////////// SETTINGS ///////////////
private[this] def decodeSettingsFrame(buffer: ByteBuffer, streamId: Int, flags: Byte): Result =
SettingsDecoder.decodeSettingsFrame(buffer, streamId, flags) match {
case Right(SettingsFrame(settings)) =>
Expand All @@ -211,7 +211,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener
Error(ex)
}

//////////// PUSH_PROMISE ///////////////
// ////////// PUSH_PROMISE ///////////////
private[this] def decodePushPromiseFrame(buffer: ByteBuffer, streamId: Int, flags: Byte): Result =
if (streamId == 0)
Error(PROTOCOL_ERROR.goaway("PUSH_PROMISE frame with stream id 0x0"))
Expand Down Expand Up @@ -240,7 +240,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener
}
}

//////////// PING ///////////////
// ////////// PING ///////////////
private[this] def decodePingFrame(buffer: ByteBuffer, streamId: Int, flags: Byte): Result = {
val PingSize = 8
if (streamId != 0)
Expand All @@ -255,7 +255,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener
}
}

//////////// GOAWAY ///////////////
// ////////// GOAWAY ///////////////
private[this] def decodeGoAwayFrame(buffer: ByteBuffer, streamId: Int): Result =
if (streamId != 0)
Error(PROTOCOL_ERROR.goaway(s"GOAWAY frame with stream id ${hexStr(streamId)} != 0x0."))
Expand All @@ -268,7 +268,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener
listener.onGoAwayFrame(lastStream, code, data)
}

//////////// WINDOW_UPDATE ///////////////
// ////////// WINDOW_UPDATE ///////////////
private[this] def decodeWindowUpdateFrame(buffer: ByteBuffer, streamId: Int): Result =
if (buffer.remaining != 4)
Error(
Expand All @@ -287,7 +287,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener
}
}

//////////// CONTINUATION ///////////////
// ////////// CONTINUATION ///////////////
private[this] def decodeContinuationFrame(
buffer: ByteBuffer,
streamId: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ private[http2] object FrameSerializer {
buffer :: headerBuffer :: Nil
}

//////////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////////

private[this] def writePriority(p: Priority.Dependent, buffer: ByteBuffer): Unit = {
if (p.exclusive)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private abstract class HeaderAggregatingFrameListener(

private[this] var hInfo: PartialFrame = null

///////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////

/** Called on the successful receipt of a complete HEADERS block
*
Expand Down Expand Up @@ -85,7 +85,7 @@ private abstract class HeaderAggregatingFrameListener(
*/
def onCompletePushPromiseFrame(streamId: Int, promisedId: Int, headers: Headers): Result

////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////

final def setMaxHeaderTableSize(maxSize: Int): Unit =
headerDecoder.setMaxHeaderTableSize(maxSize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private class SessionFlowControlImpl(
private[this] def sessionWindowString: String =
s"Session: {inbound: $sessionInboundWindow, unconsumed: $sessionUnconsumedBytes, outbound: $sessionOutboundWindow}"

////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////

private[this] final class StreamFlowWindowImpl(val streamId: Int) extends StreamFlowWindow {
private[this] var _streamInboundWindow: Int =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private abstract class StreamStateImpl(session: SessionCore) extends StreamState
}
}

///////////////////// Inbound messages ///////////////////////////////
// /////////////////// Inbound messages ///////////////////////////////

final override def invokeInboundData(
endStream: Boolean,
Expand Down Expand Up @@ -249,7 +249,7 @@ private abstract class StreamStateImpl(session: SessionCore) extends StreamState
Continue
}

//////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////

final override protected def doClosePipeline(cause: Option[Throwable]): Unit =
session.serialExecutor.execute(new Runnable { def run(): Unit = doCloseWithError(cause) })
Expand Down
2 changes: 1 addition & 1 deletion http/src/main/scala/org/http4s/blaze/http/http2/bits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private[http2] object bits {
val CONTINUATION: Byte = 0x09
}

//////////////////////////////////////////////////
// ////////////////////////////////////////////////

object Flags {
val END_STREAM: Byte = 0x1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class SessionFlowControlSuite extends BlazeTestSuite {
}
}

////////////////// Streams ////////////////////////////
// //////////////// Streams ////////////////////////////

test(
"A SessionFlowControl.StreamFlowWindow inbound window should start with the config initial flow windows") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Benchmarks extends BlazeTestSuite {
}

override def headerComplete(name: String, value: String): Boolean =
//println(s"Header($name, $value)")
// println(s"Header($name, $value)")
super.headerComplete(name, value)

// override def submitRequestLine(methodString: String, uri: String, scheme: String, majorversion: Int, minorversion: Int): Unit = {
Expand All @@ -104,7 +104,7 @@ class Benchmarks extends BlazeTestSuite {
assert(p.parseLine(b)) // should equal(true)
assert(p.requestLineComplete())

p.parseheaders(b) //should equal(true)
p.parseheaders(b) // should equal(true)
assert(p.headersComplete())

p.parsecontent(b)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class ClientParserSuite extends BlazeTestSuite {
val p = new TestParser
val msg = resp + l_headersstr

//println(msg.replace("\r\n", "\\r\\n\r\n"))
// println(msg.replace("\r\n", "\\r\\n\r\n"))

val bts = wrap(msg.getBytes(ISO_8859_1))
assert(p.parseResponse(bts))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ServerParserSuite extends BlazeTestSuite {
}

def headerComplete(name: String, value: String) = {
//println(s"Found header: '$name': '$value'")
// println(s"Found header: '$name': '$value'")
h += ((name, value))
false
}
Expand Down Expand Up @@ -303,7 +303,7 @@ class ServerParserSuite extends BlazeTestSuite {
val req = mockChunked.substring(0, mockChunked.length - 2) + "Foo\r\n\r\n"
val b = strToBuffer(req)

//println(mockChunked)
// println(mockChunked)

assert(p.parseLine(b))

Expand Down