Added version to user agent info, and other minor fixes

This commit is contained in:
2017-07-05 00:37:45 +02:00
parent 35d7486869
commit d3a06e7639
12 changed files with 69 additions and 14 deletions

View File

@ -41,7 +41,7 @@ class NetworkConnectionInitializer(
fun start() {
if (mode == Connection.Mode.CLIENT || mode == Connection.Mode.SYNC) {
send(Version(nonce = ctx.clientNonce, addrFrom = NetworkAddress.ANY, addrRecv = node))
send(Version(nonce = ctx.clientNonce, addrFrom = NetworkAddress.ANY, addrRecv = node, userAgent = ctx.userAgent))
}
}

View File

@ -408,18 +408,18 @@ class NioNetworkHandler : NetworkHandler, InternalContext.ContextHolder {
val incomingConnections = TreeMap<Long, Int>()
val outgoingConnections = TreeMap<Long, Int>()
for (connection in connections.keys) {
if (connection.state == Connection.State.ACTIVE) {
for (stream in connection.streams) {
connections.keys
.filter { it.state == Connection.State.ACTIVE }
.forEach {
for (stream in it.streams) {
streams.add(stream)
if (connection.mode == SERVER) {
if (it.mode == SERVER) {
DebugUtils.inc(incomingConnections, stream)
} else {
DebugUtils.inc(outgoingConnections, stream)
}
}
}
}
val streamProperties = mutableListOf<Property>()
for (stream in streams) {
val incoming = incomingConnections[stream] ?: 0