Skip to content

Commit 4ea7c31

Browse files
committed
Demote connection breakage from error to warning
1 parent af688d5 commit 4ea7c31

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ The project is published to Sonatype OSS:
7373
sbt users may add this to their `build.sbt`:
7474

7575
```
76-
libraryDependencies += "io.github.erikvanzijst" %% "scala-tlsproxy_2.12" % "0.2.0"
76+
libraryDependencies += "io.github.erikvanzijst" % "scala-tlsproxy_2.12" % "0.3.0"
7777
```
7878

7979
To use it as a library in-process:

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name := "scala-tlsproxy"
22
organization := "io.github.erikvanzijst"
33

4-
version := "0.3.0-SNAPSHOT"
4+
version := "0.3.0"
55

66
scalaVersion := "2.12.14"
77

src/main/scala/io/github/erikvanzijst/scalatlsproxy/TlsProxyHandler.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object ProxyPhase extends Enumeration {
1919

2020
object TlsProxyHandler {
2121
val destPattern: Regex = "CONNECT ([^:]+):([0-9]+) HTTP/1.1".r
22-
val userAgent: String = "TlsProxy/1.0 (github.com/erikvanzijst/scala_tlsproxy)"
22+
val userAgent: String = "TlsProxy/0.3.0 (github.com/erikvanzijst/scala_tlsproxy)"
2323
}
2424

2525
class TlsProxyHandler(selector: Selector, clientChannel: SocketChannel) extends KeyHandler with StrictLogging {
@@ -54,7 +54,7 @@ class TlsProxyHandler(selector: Selector, clientChannel: SocketChannel) extends
5454

5555
private def readClient(): Unit = {
5656
if (clientKey.isValid && clientKey.isReadable && clientChannel.read(clientBuffer) == -1)
57-
throw new IOException(s"$clientAddress unexpected EOF from client")
57+
throw new IOException(s"$clientAddress unexpected EOF from client")
5858
if (!clientBuffer.hasRemaining)
5959
throw new IOException(s"$clientAddress handshake overflow")
6060
}
@@ -183,11 +183,10 @@ class TlsProxyHandler(selector: Selector, clientChannel: SocketChannel) extends
183183

184184
} catch {
185185
case e: IOException =>
186-
187186
val msg = s"$clientAddress -> $getServerAddress" +
188187
(if (phase == Established) s" (up: ${upstreamPipe.bytes} down: ${downstreamPipe.bytes})" else "") +
189188
s" connection failed: ${e.getClass.getSimpleName}: ${e.getMessage}"
190-
logger.error(msg)
189+
logger.warn(msg)
191190
close()
192191
}
193192

0 commit comments

Comments
 (0)