Fixed conversion mistake

This commit is contained in:
Amos Ng 2020-06-18 07:01:51 +08:00
parent 46e5cf23f8
commit 094347f1c6
No known key found for this signature in database
GPG key ID: 89086414F634D123
2 changed files with 3 additions and 3 deletions

View file

@ -42,7 +42,7 @@ public class ServerHandler {
params.put("secret", settings.getClientSecret()); params.put("secret", settings.getClientSecret());
params.put("port", settings.getClientPort()); params.put("port", settings.getClientPort());
params.put("disk_space", settings.getMaxCacheSizeInMebibytes() * 1024 * 1024 /* MiB to bytes */); params.put("disk_space", settings.getMaxCacheSizeInMebibytes() * 1024 * 1024 /* MiB to bytes */);
params.put("network_speed", settings.getMaxKilobitsPerSecond() * 1000 * 8 /* Kbps to bytes */); params.put("network_speed", settings.getMaxKilobitsPerSecond() * 1000 / 8 /* Kbps to bytes */);
params.put("build_version", Constants.CLIENT_BUILD); params.put("build_version", Constants.CLIENT_BUILD);
HttpResponse<ServerSettings> response = Unirest.post(SERVER_ADDRESS + "ping") HttpResponse<ServerSettings> response = Unirest.post(SERVER_ADDRESS + "ping")
@ -66,7 +66,7 @@ public class ServerHandler {
params.put("secret", settings.getClientSecret()); params.put("secret", settings.getClientSecret());
params.put("port", settings.getClientPort()); params.put("port", settings.getClientPort());
params.put("disk_space", settings.getMaxCacheSizeInMebibytes() * 1024 * 1024 /* MiB to bytes */); params.put("disk_space", settings.getMaxCacheSizeInMebibytes() * 1024 * 1024 /* MiB to bytes */);
params.put("network_speed", settings.getMaxKilobitsPerSecond() * 1000 * 8 /* Kbps to bytes */); params.put("network_speed", settings.getMaxKilobitsPerSecond() * 1000 / 8 /* Kbps to bytes */);
params.put("build_version", Constants.CLIENT_BUILD); params.put("build_version", Constants.CLIENT_BUILD);
params.put("tls_created_at", old.getTls().getCreatedAt()); params.put("tls_created_at", old.getTls().getCreatedAt());

View file

@ -46,7 +46,7 @@ class Netty(private val tls: ServerSettings.TlsCert, private val clientSettings:
private lateinit var address: InetSocketAddress private lateinit var address: InetSocketAddress
private val burstLimiter = object : GlobalTrafficShapingHandler( private val burstLimiter = object : GlobalTrafficShapingHandler(
workerGroup, clientSettings.maxKilobitsPerSecond * 1000L, 0, 50) { workerGroup, clientSettings.maxKilobitsPerSecond * 1000L / 8L, 0, 50) {
override fun doAccounting(counter: TrafficCounter) { override fun doAccounting(counter: TrafficCounter) {
statistics.getAndUpdate { statistics.getAndUpdate {
it.copy(bytesSent = it.bytesSent + counter.cumulativeWrittenBytes()) it.copy(bytesSent = it.bytesSent + counter.cumulativeWrittenBytes())