Skip to content

Commit

Permalink
Merge pull request #2870 from HenrikJannsen/set-version-2.1.1
Browse files Browse the repository at this point in the history
Set version 2.1.1
  • Loading branch information
HenrikJannsen authored Sep 29, 2024
2 parents a1f3138 + cc5cf7f commit 9d0091e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx4096M
version=2.1.0
version=2.1.1
tor.version=13.5.2
11 changes: 3 additions & 8 deletions network/network/src/main/java/bisq/network/p2p/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import com.runjva.sourceforge.jsocks.protocol.Socks5Proxy;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -78,8 +77,7 @@
@Slf4j
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class Node implements Connection.Handler {
@Setter
public static int preferredVersion = 0;
public static final int PREFERRED_VERSION = 1;

public enum State {
NEW,
Expand Down Expand Up @@ -408,19 +406,16 @@ private Connection createOutboundConnection(Address address) {
}

private Connection createOutboundConnection(Address address, Capability myCapability) {
// To get better chances to use the right version at the first attempt we use the preferredVersion which will
// be set from another higher level service and is based on the distribution of versions.
// If v2.1.0 reaches 50% distribution rate we use version 1 as preferredVersion.
// This code can be removed once no old versions are expected anymore.
Capability candidate = Capability.withVersion(myCapability, preferredVersion);
Capability candidate = Capability.withVersion(myCapability, PREFERRED_VERSION);
log.info("Create outbound connection to {} with capability version 1", address);
try {
return doCreateOutboundConnection(address, candidate);
} catch (ConnectionException e) {
if (e.getCause() != null && e.getReason() != null && e.getReason() == HANDSHAKE_FAILED) {
log.warn("Handshake at creating outbound connection to {} failed. We try again with capability version 0. Error: {}",
address, ExceptionUtil.getRootCauseMessage(e));
int version = preferredVersion == 0 ? 1 : 0;
int version = PREFERRED_VERSION == 0 ? 1 : 0;
candidate = Capability.withVersion(myCapability, version);
return doCreateOutboundConnection(address, candidate);
} else {
Expand Down
9 changes: 0 additions & 9 deletions user/src/main/java/bisq/user/profile/UserProfileService.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import bisq.common.observable.collection.ObservableSet;
import bisq.common.observable.map.ObservableHashMap;
import bisq.network.NetworkService;
import bisq.network.p2p.node.Node;
import bisq.network.p2p.services.data.DataService;
import bisq.network.p2p.services.data.storage.auth.AuthenticatedData;
import bisq.persistence.DbSubDirectory;
Expand Down Expand Up @@ -166,14 +165,6 @@ private void processUserProfileAddedOrRefreshed(UserProfile userProfile) {
}
numUserProfiles.set(userProfileById.values().size());
persist();

double updated = getUserProfiles().stream()
.mapToLong(UserProfile::getVersion)
.average()
.orElse(0);
if (updated >= 0.5) {
Node.setPreferredVersion(1);
}
}
} else {
if (userProfile.getPublishDate() > existingUserProfile.get().getPublishDate()) {
Expand Down

0 comments on commit 9d0091e

Please sign in to comment.