Commit 6b5b12d4 authored by bornholdt's avatar bornholdt
Browse files

Fix some code smells

parent 59025e1d
Pipeline #40918 passed with stages
in 5 minutes and 31 seconds
......@@ -62,15 +62,6 @@ abstract class AbstractMessage implements Message {
this.hopCount = hopCount;
}
protected AbstractMessage(final MessageId id,
final String userAgent,
final int networkId,
final CompressedPublicKey sender,
final ProofOfWork proofOfWork,
final CompressedPublicKey recipient) {
this(id, userAgent, networkId, sender, proofOfWork, recipient, (short) 0);
}
protected AbstractMessage(final int networkId,
final CompressedPublicKey sender,
final ProofOfWork proofOfWork,
......@@ -86,12 +77,12 @@ abstract class AbstractMessage implements Message {
this(networkId, sender, proofOfWork, recipient, (short) 0);
}
public AbstractMessage(final MessageId id,
final int networkId,
final CompressedPublicKey sender,
final ProofOfWork proofOfWork,
final CompressedPublicKey recipient,
final short hopCount) {
protected AbstractMessage(final MessageId id,
final int networkId,
final CompressedPublicKey sender,
final ProofOfWork proofOfWork,
final CompressedPublicKey recipient,
final short hopCount) {
this(id, userAgentGenerator.get(), networkId, sender, proofOfWork, recipient, hopCount);
}
......
......@@ -28,35 +28,24 @@ import static java.util.Objects.requireNonNull;
abstract class AbstractResponseMessage<R extends RequestMessage> extends AbstractMessage implements ResponseMessage<R> {
protected final MessageId correspondingId;
protected AbstractResponseMessage(final MessageId id,
final String userAgent,
final int networkId,
protected AbstractResponseMessage(final int networkId,
final CompressedPublicKey sender,
final ProofOfWork proofOfWork,
final CompressedPublicKey recipient,
final MessageId correspondingId) {
super(id, userAgent, networkId, sender, proofOfWork, recipient);
super(networkId, sender, proofOfWork, recipient);
this.correspondingId = requireNonNull(correspondingId);
}
protected AbstractResponseMessage(final int networkId,
@SuppressWarnings({ "java:S107" })
protected AbstractResponseMessage(final MessageId id,
final String userAgent,
final int networkId,
final CompressedPublicKey sender,
final ProofOfWork proofOfWork,
final CompressedPublicKey recipient,
final short hopCount,
final MessageId correspondingId) {
super(networkId, sender, proofOfWork, recipient);
this.correspondingId = requireNonNull(correspondingId);
}
@SuppressWarnings({ "java:S107" })
public AbstractResponseMessage(final MessageId id,
final String userAgent,
final int networkId,
final CompressedPublicKey sender,
final ProofOfWork proofOfWork,
final CompressedPublicKey recipient,
final short hopCount,
final MessageId correspondingId) {
super(id, userAgent, networkId, sender, proofOfWork, recipient, hopCount);
this.correspondingId = requireNonNull(correspondingId);
}
......
/*
* Copyright (c) 2020.
*
* This file is part of drasyl.
*
* drasyl is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* drasyl is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with drasyl. If not, see <http://www.gnu.org/licenses/>.
*/
package org.drasyl.peer.connection.message;
public interface RelayableMessage extends Message {
}
\ No newline at end of file
......@@ -32,13 +32,13 @@ import java.util.concurrent.CompletableFuture;
*/
@SuppressWarnings({ "common-java:DuplicatedBlocks" })
abstract class AbstractEndHandler extends AbstractHandlerContext implements Handler {
public AbstractEndHandler(final String name,
final DrasylConfig config,
final Pipeline pipeline,
final Scheduler scheduler,
final Identity identity,
final TypeValidator inboundValidator,
final TypeValidator outboundValidator) {
protected AbstractEndHandler(final String name,
final DrasylConfig config,
final Pipeline pipeline,
final Scheduler scheduler,
final Identity identity,
final TypeValidator inboundValidator,
final TypeValidator outboundValidator) {
super(name, config, pipeline, scheduler, identity, inboundValidator, outboundValidator);
}
......
......@@ -44,13 +44,13 @@ abstract class AbstractHandlerContext implements HandlerContext {
private volatile AbstractHandlerContext prev;
private volatile AbstractHandlerContext next;
public AbstractHandlerContext(final String name,
final DrasylConfig config,
final Pipeline pipeline,
final Scheduler scheduler,
final Identity identity,
final TypeValidator inboundValidator,
final TypeValidator outboundValidator) {
protected AbstractHandlerContext(final String name,
final DrasylConfig config,
final Pipeline pipeline,
final Scheduler scheduler,
final Identity identity,
final TypeValidator inboundValidator,
final TypeValidator outboundValidator) {
this(null, null, name, config, pipeline, scheduler, identity, inboundValidator, outboundValidator);
}
......
......@@ -5,7 +5,7 @@ drasyl {
# to other nodes and form a private network. If you’re planning to create your own network on the
# Internet, it’s best to choose a network ID that isn’t already used.
# Note: Make sure that the configured Super Peers use the same network ID.
network.id = 1
network.id = -25421
# Each node has a unique identity. It is composed of a public-private key pair. The address
# of the node is derived from the public key. In a future release, messages will be signed
......@@ -110,7 +110,7 @@ drasyl {
# List of endpoints that are used to connect to a Super Peer. Entries at the beginning of
# the list are first tried.
# Note: Make sure that the configured Super Peers use the same network ID as this node.
endpoints = ["wss://production.env.drasyl.org#025fff6f625f5dee816d9f8fe43895479aecfda187cb6a3330894a07e698bc5bd8"]
endpoints = ["wss://staging.env.drasyl.org#03096ae3080a369829a44847d5af1f652bef3f9921e9e1bbad64970babe6d3c502"]
# If the connection to the super peer is lost, a new connection is attempted after a some
# time. Here you can specify a list with the desired delays, which the node will wait before
......@@ -226,7 +226,7 @@ drasyl {
# Every outgoing message starts with the value defined here. Each node decreases the
# message's hop-limit value before routing it to the next node. If the hop-limit value reaches
# zero before the message arrives at its destination, then the message is discarded.
hop-limit = 64
hop-limit = 8
}
# Size of the TCP Flush Buffer. Is used to minimize IO overhead.
......
......@@ -7,12 +7,12 @@
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* drasyl is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with drasyl. If not, see <http://www.gnu.org/licenses/>.
*/
......@@ -27,8 +27,8 @@ abstract class GroupMemberActionEvent implements GroupEvent {
protected final CompressedPublicKey member;
protected final Group group;
public GroupMemberActionEvent(
final CompressedPublicKey member, final Group group) {
protected GroupMemberActionEvent(final CompressedPublicKey member,
final Group group) {
this.member = member;
this.group = group;
}
......
......@@ -29,9 +29,8 @@ import static java.util.Objects.requireNonNull;
abstract class MemberActionMessage extends GroupActionMessage {
protected final CompressedPublicKey member;
public MemberActionMessage(
@JsonProperty("member") final CompressedPublicKey member,
@JsonProperty("group") final Group group) {
protected MemberActionMessage(@JsonProperty("member") final CompressedPublicKey member,
@JsonProperty("group") final Group group) {
super(group);
this.member = requireNonNull(member);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment