Skip to content

Commit

Permalink
reduce lofi connection manager chatter …
Browse files Browse the repository at this point in the history
  • Loading branch information
rmgk committed Dec 12, 2024
1 parent d7d8e04 commit 195c9a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ConnectionManager[MSG](
}

def acceptIncomingConnections(): Unit = {
println(s"$localPublicId is accepting connections on port ${connector.listenPort}")
if false then println(s"$localPublicId is accepting connections on port ${connector.listenPort}")

def acceptConnection(): Unit =
if stopped then running = false
Expand All @@ -73,7 +73,7 @@ class ConnectionManager[MSG](
connectionFuture.onComplete {
case Failure(exception) =>
running = false
Console.err.println("Stopping listener")
if false then Console.err.println("Stopping listener")
case Success((socket, peerIdentity)) =>
if peerIdentity == localPublicId
then // We don't want to connect to ourselves.
Expand Down Expand Up @@ -136,7 +136,7 @@ class ConnectionManager[MSG](
if expectedUser == peerId
then connectionEstablished(socket, peerId, establishedByRemote = false)
else {
Console.err.println(s"Expecting $expectedUser at $host:$port but connected to $peerId. Closing socket.")
if false then Console.err.println(s"Expecting $expectedUser at $host:$port but connected to $peerId. Closing socket.")
try {
socket.close()
} catch
Expand All @@ -154,7 +154,7 @@ class ConnectionManager[MSG](
peerIdentity: PublicIdentity,
establishedByRemote: Boolean
): Unit = {
println(s"Established connection with $peerIdentity at ${socket.getRemoteSocketAddress}")
if false then println(s"Established connection with $peerIdentity at ${socket.getRemoteSocketAddress}")

this.synchronized {
connections.get(peerIdentity) match
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class ConnectionManagerTest extends FunSuite {
private val idC = IdentityFactory.createNewIdentity
private val idD = IdentityFactory.createNewIdentity

println(s"idA = ${idA.getPublic.id}")
println(s"idB = ${idB.getPublic.id}")
println(s"idC = ${idC.getPublic.id}")
println(s"idD = ${idD.getPublic.id}")
if false then println(s"idA = ${idA.getPublic.id}")
if false then println(s"idB = ${idB.getPublic.id}")
if false then println(s"idC = ${idC.getPublic.id}")
if false then println(s"idD = ${idD.getPublic.id}")

test("Only establish connection and don't send anything") {
val receiverA = QueueAppendingMessageReceiver()
Expand Down Expand Up @@ -372,10 +372,10 @@ object ConnectionManagerTest {
}

override def connectionEstablished(publicIdentity: PublicIdentity): Unit =
println(s"${localId.map(_.id).getOrElse("Replica")} is now connected to ${publicIdentity.id}")
if false then println(s"${localId.map(_.id).getOrElse("Replica")} is now connected to ${publicIdentity.id}")

override def connectionShutdown(publicIdentity: PublicIdentity): Unit =
println(s"${localId.map(_.id).getOrElse("Replica")} connectionShutdown to $publicIdentity")
if false then println(s"${localId.map(_.id).getOrElse("Replica")} connectionShutdown to $publicIdentity")
}

given JsonValueCodec[String] = JsonCodecMaker.make
Expand Down

0 comments on commit 195c9a3

Please sign in to comment.