Skip to content

Commit

Permalink
Scalafmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilquist committed Feb 20, 2021
1 parent 6559aa0 commit f7a2848
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions io/src/main/scala/fs2/io/tls/TLSEngine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,12 @@ private[tls] object TLSEngine {
// Check if the initial handshake has finished -- if so, read; otherwise, handshake and then read
dequeueUnwrap(maxBytes).flatMap { out =>
if (out.isEmpty)
initialHandshakeDone.ifM(read1(maxBytes, timeout),
initialHandshakeDone.ifM(
read1(maxBytes, timeout),
write(Chunk.empty, None) >> dequeueUnwrap(maxBytes).flatMap { out =>
if (out.isEmpty) read1(maxBytes, timeout) else Applicative[F].pure(out)
})
}
)
else Applicative[F].pure(out)
}

Expand Down Expand Up @@ -209,7 +211,10 @@ private[tls] object TLSEngine {
else
binding.read(engine.getSession.getPacketBufferSize, timeout).flatMap {
case Some(c) => unwrapBuffer.input(c) >> unwrapHandshake(timeout)
case None => unwrapBuffer.inputRemains.flatMap(x => if (x > 0) Applicative[F].unit else stopUnwrap)
case None =>
unwrapBuffer.inputRemains.flatMap(x =>
if (x > 0) Applicative[F].unit else stopUnwrap
)
}
}
case SSLEngineResult.HandshakeStatus.NEED_UNWRAP_AGAIN =>
Expand Down

0 comments on commit f7a2848

Please sign in to comment.