Skip to content

Commit

Permalink
Merge pull request #194 from libp2p/0.8.3
Browse files Browse the repository at this point in the history
Release 0.8.3
  • Loading branch information
ajsutton authored Jul 12, 2021
2 parents a0ece47 + 5b41ae4 commit 7963bd7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Hosting of artefacts is graciously provided by [Cloudsmith](https://cloudsmith.c
maven { url "https://dl.cloudsmith.io/public/libp2p/jvm-libp2p/maven/" }
}
implementation 'io.libp2p:jvm-libp2p-minimal:0.8.2-RELEASE'
implementation 'io.libp2p:jvm-libp2p-minimal:0.8.3-RELEASE'
```
### Using Maven
Add the repository to the `dependencyManagement` section of the pom file:
Expand All @@ -96,7 +96,7 @@ And then add jvm-libp2p as a dependency:
<dependency>
<groupId>io.libp2p</groupId>
<artifactId>jvm-libp2p-minimal</artifactId>
<version>0.8.2-RELEASE</version>
<version>0.8.3-RELEASE</version>
<type>pom</type>
</dependency>
```
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import java.nio.file.Paths
// ./gradlew publish -PcloudsmithUser=<user> -PcloudsmithApiKey=<api-key>

group = "io.libp2p"
version = "0.8.2-RELEASE"
version = "0.8.3-RELEASE"
description = "a minimal implementation of libp2p for the jvm"

plugins {
Expand Down Expand Up @@ -235,4 +235,4 @@ fun findProperty(s: String) = project.findProperty(s) as String?
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
languageVersion = "1.4"
}
}
2 changes: 1 addition & 1 deletion src/main/kotlin/io/libp2p/pubsub/AbstractRouter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ abstract class AbstractRouter(
when {
err != null -> logger.warn("Exception while handling message from peer $peer: ${it.first}", err)
res == ValidationResult.Invalid -> logger.debug("Invalid pubsub message from peer $peer: ${it.first}")
res == ValidationResult.Ignore -> logger.debug("Ingnoring pubsub message from peer $peer: ${it.first}")
res == ValidationResult.Ignore -> logger.trace("Ignoring pubsub message from peer $peer: ${it.first}")
else -> {
newValidatedMessages(singletonList(it.first), peer)
flushAllPending()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import io.netty.channel.CombinedChannelDuplexHandler
import io.netty.channel.SimpleChannelInboundHandler
import io.netty.handler.codec.LengthFieldBasedFrameDecoder
import io.netty.handler.codec.LengthFieldPrepender
import io.netty.handler.timeout.ReadTimeoutHandler
import org.apache.logging.log4j.LogManager
import spipe.pb.Spipe
import java.util.concurrent.CompletableFuture
Expand All @@ -33,8 +34,10 @@ private enum class Role(val intVal: Int) { INIT(HandshakeState.INITIATOR), RESP(

private val log = LogManager.getLogger(NoiseXXSecureChannel::class.java)
private const val HandshakeNettyHandlerName = "HandshakeNettyHandler"
private const val HandshakeReadTimeoutNettyHandlerName = "HandshakeReadTimeoutNettyHandler"
private const val NoiseCodeNettyHandlerName = "NoiseXXCodec"
private const val MaxCipheredPacketLength = 65535
private const val HandshakeTimeoutSec = 5

class UShortLengthCodec : CombinedChannelDuplexHandler<LengthFieldBasedFrameDecoder, LengthFieldPrepender>(
LengthFieldBasedFrameDecoder(MaxCipheredPacketLength + 2, 0, 2, 0, 2),
Expand Down Expand Up @@ -70,7 +73,8 @@ class NoiseXXSecureChannel(private val localKey: PrivKey) :
val handshakeComplete = CompletableFuture<SecureChannel.Session>()
// Packet length codec should stay forever.
ch.pushHandler(UShortLengthCodec())
// Handshake handle is to be removed when handshake is complete
// Handshake and ReadTimeout handlers are to be removed when handshake is complete
ch.pushHandler(HandshakeReadTimeoutNettyHandlerName, ReadTimeoutHandler(HandshakeTimeoutSec))
ch.pushHandler(
HandshakeNettyHandlerName,
NoiseIoHandshake(localKey, handshakeComplete, if (ch.isInitiator) Role.INIT else Role.RESP)
Expand Down Expand Up @@ -302,6 +306,7 @@ private class NoiseIoHandshake(
"NoisePacketSplitter",
SplitEncoder(MaxCipheredPacketLength - session.aliceCipher.macLength)
)
ctx.pipeline().remove(HandshakeReadTimeoutNettyHandlerName)
ctx.pipeline().remove(this)
ctx.fireChannelActive()
} // handshakeSucceeded
Expand All @@ -313,6 +318,7 @@ private class NoiseIoHandshake(
log.debug("Noise handshake failed", cause)

handshakeComplete.completeExceptionally(cause)
ctx.pipeline().remove(HandshakeReadTimeoutNettyHandlerName)
ctx.pipeline().remove(this)
}
} // class NoiseIoHandshake
Expand Down

0 comments on commit 7963bd7

Please sign in to comment.