Skip to content

Commit

Permalink
Merge branch 'HotFix_0.4.8.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ManfredKarrer committed Jul 5, 2016
2 parents 49ef005 + b3dc95f commit 251656e
Show file tree
Hide file tree
Showing 21 changed files with 59 additions and 40 deletions.
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>io.bitsquare</groupId>
<version>0.4.8</version>
<version>0.4.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/io/bitsquare/app/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Version {
private static final Logger log = LoggerFactory.getLogger(Version.class);

// The application versions
public static final String VERSION = "0.4.8";
public static final String VERSION = "0.4.8.1";

// The version nr. for the objects sent over the network. A change will break the serialization of old objects.
// If objects are used for both network and database the network version is applied.
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>io.bitsquare</groupId>
<version>0.4.8</version>
<version>0.4.8.1</version>
</parent>

<artifactId>core</artifactId>
Expand Down
56 changes: 35 additions & 21 deletions core/src/main/java/io/bitsquare/arbitration/ArbitratorManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import io.bitsquare.p2p.P2PService;
import io.bitsquare.p2p.storage.HashMapChangedListener;
import io.bitsquare.p2p.storage.storageentry.ProtectedStorageEntry;
import io.bitsquare.user.Preferences;
import io.bitsquare.user.User;
import javafx.collections.FXCollections;
import javafx.collections.ObservableMap;
Expand Down Expand Up @@ -94,7 +95,9 @@ public class ArbitratorManager {
private final KeyRing keyRing;
private final ArbitratorService arbitratorService;
private final User user;
private Preferences preferences;
private final ObservableMap<NodeAddress, Arbitrator> arbitratorsObservableMap = FXCollections.observableHashMap();
private final List<Arbitrator> persistedAcceptedArbitrators;
private Timer republishArbitratorTimer, retryRepublishArbitratorTimer;


Expand All @@ -103,20 +106,26 @@ public class ArbitratorManager {
///////////////////////////////////////////////////////////////////////////////////////////

@Inject
public ArbitratorManager(KeyRing keyRing, ArbitratorService arbitratorService, User user) {
public ArbitratorManager(KeyRing keyRing, ArbitratorService arbitratorService, User user, Preferences preferences) {
this.keyRing = keyRing;
this.arbitratorService = arbitratorService;
this.user = user;
this.preferences = preferences;

persistedAcceptedArbitrators = new ArrayList<>(user.getAcceptedArbitrators());
user.clearAcceptedArbitrators();

arbitratorService.addHashSetChangedListener(new HashMapChangedListener() {
@Override
public void onAdded(ProtectedStorageEntry data) {
applyArbitrators();
if (data.getStoragePayload() instanceof Arbitrator)
updateArbitratorMap();
}

@Override
public void onRemoved(ProtectedStorageEntry data) {
applyArbitrators();
if (data.getStoragePayload() instanceof Arbitrator)
updateArbitratorMap();
}
});
}
Expand Down Expand Up @@ -145,7 +154,7 @@ public void onBootstrapComplete() {
});
}

applyArbitrators();
updateArbitratorMap();
}

private void isBootstrapped() {
Expand All @@ -156,29 +165,34 @@ private void isBootstrapped() {
}
}

public void applyArbitrators() {
public void updateArbitratorMap() {
Map<NodeAddress, Arbitrator> map = arbitratorService.getArbitrators();
log.trace("Arbitrators . size=" + map.values().size());
arbitratorsObservableMap.clear();
Map<NodeAddress, Arbitrator> filtered = map.values().stream()
.filter(e -> isPublicKeyInList(Utils.HEX.encode(e.getRegistrationPubKey()))
&& verifySignature(e.getPubKeyRing().getSignaturePubKey(), e.getRegistrationPubKey(), e.getRegistrationSignature()))
.collect(Collectors.toMap(Arbitrator::getArbitratorNodeAddress, Function.identity()));

arbitratorsObservableMap.putAll(filtered);
// we need to remove accepted arbitrators which are not available anymore
if (user.getAcceptedArbitrators() != null) {
List<Arbitrator> removeList = user.getAcceptedArbitrators().stream()
.filter(e -> !arbitratorsObservableMap.containsValue(e))
.collect(Collectors.toList());
removeList.stream().forEach(user::removeAcceptedArbitrator);

// if we don't have any arbitrator anymore we set all matching
if (user.getAcceptedArbitrators().isEmpty()) {
arbitratorsObservableMap.values().stream()
.filter(user::hasMatchingLanguage)
.forEach(user::addAcceptedArbitrator);
}
arbitratorsObservableMap.values().stream()
.filter(arbitrator -> persistedAcceptedArbitrators.contains(arbitrator))
.forEach(user::addAcceptedArbitrator);

if (preferences.getAutoSelectArbitrators()) {
arbitratorsObservableMap.values().stream()
.filter(user::hasMatchingLanguage)
.forEach(user::addAcceptedArbitrator);
} else {
// if we don't have any arbitrator we set all matching
// we use a delay as we might get our matching arbitrator a bit delayed (first we get one we did not selected
// then we get our selected one - we don't want to activate the first in that case)
UserThread.runAfter(() -> {
if (user.getAcceptedArbitrators().isEmpty()) {
arbitratorsObservableMap.values().stream()
.filter(user::hasMatchingLanguage)
.forEach(user::addAcceptedArbitrator);
}
}, 100, TimeUnit.MILLISECONDS);
}
}

Expand All @@ -191,7 +205,7 @@ public void addArbitrator(Arbitrator arbitrator, ResultHandler resultHandler, Er
resultHandler.handleResult();

if (arbitratorsObservableMap.size() > 0)
UserThread.runAfter(this::applyArbitrators, 100, TimeUnit.MILLISECONDS);
UserThread.runAfter(this::updateArbitratorMap, 100, TimeUnit.MILLISECONDS);
},
errorMessageHandler::handleErrorMessage);
}
Expand Down Expand Up @@ -244,7 +258,7 @@ private void republishArbitrator() {
Arbitrator registeredArbitrator = user.getRegisteredArbitrator();
if (registeredArbitrator != null) {
addArbitrator(registeredArbitrator,
this::applyArbitrators,
this::updateArbitratorMap,
errorMessage -> {
if (retryRepublishArbitratorTimer == null)
retryRepublishArbitratorTimer = UserThread.runPeriodically(() -> {
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/io/bitsquare/user/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ public Arbitrator getAcceptedArbitratorByAddress(NodeAddress nodeAddress) {
return null;
}

public void clearAcceptedArbitrators() {
acceptedArbitrators.clear();
storage.queueUpForSave();
}


///////////////////////////////////////////////////////////////////////////////////////////
// Utils
Expand Down
2 changes: 1 addition & 1 deletion gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>io.bitsquare</groupId>
<version>0.4.8</version>
<version>0.4.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private void applyArbitratorMap() {
protected void activate() {
languageCodes.setAll(user.getAcceptedLanguageLocaleCodes());
arbitratorManager.getArbitratorsObservableMap().addListener(arbitratorMapChangeListener);
arbitratorManager.applyArbitrators();
arbitratorManager.updateArbitratorMap();
applyArbitratorMap();

updateAutoSelectArbitrators();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private void updateArbitratorsDisputesTabDisableState() {

@Override
protected void activate() {
arbitratorManager.applyArbitrators();
arbitratorManager.updateArbitratorMap();
arbitratorManager.getArbitratorsObservableMap().addListener(arbitratorMapChangeListener);
updateArbitratorsDisputesTabDisableState();

Expand Down
2 changes: 1 addition & 1 deletion jsocks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>io.bitsquare</groupId>
<version>0.4.8</version>
<version>0.4.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion jtorctl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>io.bitsquare</groupId>
<version>0.4.8</version>
<version>0.4.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion jtorproxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>io.bitsquare</groupId>
<version>0.4.8</version>
<version>0.4.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion network/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>io.bitsquare</groupId>
<version>0.4.8</version>
<version>0.4.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion package/linux/create_32bit_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mkdir -p gui/deploy
set -e

# Edit versions
fullVersion=0.4.8
fullVersion=0.4.8.1
jarFile="/home/bitsquare/Desktop/sf_vm_shared_ubuntu14_32bit/Bitsquare-$fullVersion.jar"

# Note: fakeroot needs to be installed on linux
Expand Down
2 changes: 1 addition & 1 deletion package/linux/create_64bit_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mkdir -p gui/deploy
set -e

# Edit versions
fullVersion=0.4.8
fullVersion=0.4.8.1
jarFile="/home/mk/Desktop/sf_vm_shared_ubuntu/Bitsquare-$fullVersion.jar"

# Note: fakeroot needs to be installed on linux
Expand Down
2 changes: 1 addition & 1 deletion package/mac/create_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mkdir -p gui/deploy

set -e

fullVersion="0.4.8"
fullVersion="0.4.8.1"

mvn clean package -DskipTests -Dmaven.javadoc.skip=true

Expand Down
2 changes: 1 addition & 1 deletion package/mac/finalize.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

version="0.4.8"
version="0.4.8.1"

target_dir="/Users/mk/Documents/__bitsquare/_releases/$version"

Expand Down
2 changes: 1 addition & 1 deletion package/windows/Bitsquare.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[Setup]
AppId={{bitsquare}}
AppName=Bitsquare
AppVersion=0.4.8
AppVersion=0.4.8.1
AppVerName=Bitsquare
AppPublisher=Bitsquare
AppComments=Bitsquare
Expand Down
2 changes: 1 addition & 1 deletion package/windows/create_32bit_app.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ mkdir gui\deploy

:: 32 bit build
:: Needs Inno Setup 5 or later (http://www.jrsoftware.org/isdl.php)
call "C:\Program Files\Java\jdk1.8.0_92\bin\javapackager.exe" -deploy -BappVersion=0.4.8 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir "\\VBOXSVR\vm_shared_windows_32bit" -appclass io.bitsquare.app.BitsquareAppMain -srcfiles "\\VBOXSVR\vm_shared_windows_32bit\Bitsquare-0.4.8.jar" -outfile Bitsquare -Bruntime="C:\Program Files\Java\jdk1.8.0_92\jre" -BjvmProperties=-Djava.net.preferIPv4Stack=true
call "C:\Program Files\Java\jdk1.8.0_92\bin\javapackager.exe" -deploy -BappVersion=0.4.8.1 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir "\\VBOXSVR\vm_shared_windows_32bit" -appclass io.bitsquare.app.BitsquareAppMain -srcfiles "\\VBOXSVR\vm_shared_windows_32bit\Bitsquare-0.4.8.1.jar" -outfile Bitsquare -Bruntime="C:\Program Files\Java\jdk1.8.0_92\jre" -BjvmProperties=-Djava.net.preferIPv4Stack=true

cd package\windows
2 changes: 1 addition & 1 deletion package/windows/create_64bit_app.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ mkdir gui\deploy

:: 64 bit build
:: Needs Inno Setup 5 or later (http://www.jrsoftware.org/isdl.php)
call "C:\Program Files\Java\jdk1.8.0_92\bin\javapackager.exe" -deploy -BappVersion=0.4.8 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir "\\VBOXSVR\vm_shared_windows" -appclass io.bitsquare.app.BitsquareAppMain -srcfiles "\\VBOXSVR\vm_shared_windows\Bitsquare-0.4.8.jar" -outfile Bitsquare -Bruntime="C:\Program Files\Java\jdk1.8.0_92\jre" -BjvmProperties=-Djava.net.preferIPv4Stack=true
call "C:\Program Files\Java\jdk1.8.0_92\bin\javapackager.exe" -deploy -BappVersion=0.4.8.1 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir "\\VBOXSVR\vm_shared_windows" -appclass io.bitsquare.app.BitsquareAppMain -srcfiles "\\VBOXSVR\vm_shared_windows\Bitsquare-0.4.8.1.jar" -outfile Bitsquare -Bruntime="C:\Program Files\Java\jdk1.8.0_92\jre" -BjvmProperties=-Djava.net.preferIPv4Stack=true

cd package\windows
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>io.bitsquare</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>0.4.8</version>
<version>0.4.8.1</version>
<description>Bitsquare - The decentralized bitcoin exchange</description>
<url>https://bitsquare.io</url>

Expand Down
2 changes: 1 addition & 1 deletion seednode/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>io.bitsquare</groupId>
<version>0.4.8</version>
<version>0.4.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down

0 comments on commit 251656e

Please sign in to comment.