mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-20 23:56:30 -04:00
Renamed DHTService to AddressService
This commit is contained in:
parent
a2654d20b9
commit
1893953948
@ -24,7 +24,7 @@ import java.security.PublicKey;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
public interface DHTService {
|
||||
public interface AddressService {
|
||||
void setExecutor(Executor executor);
|
||||
|
||||
void findPeerAddress(PublicKey messagePublicKey, GetPeerAddressListener getPeerAddressListener);
|
@ -17,7 +17,7 @@
|
||||
|
||||
package io.bitsquare.network.tomp2p;
|
||||
|
||||
import io.bitsquare.network.DHTService;
|
||||
import io.bitsquare.network.AddressService;
|
||||
import io.bitsquare.network.MessageHandler;
|
||||
import io.bitsquare.network.Peer;
|
||||
import io.bitsquare.network.listener.GetPeerAddressListener;
|
||||
@ -44,8 +44,8 @@ import org.slf4j.LoggerFactory;
|
||||
* That way we limit the dependency of the TomP2P library only to that class (and it's sub components).
|
||||
* <p/>
|
||||
*/
|
||||
public class TomP2PDHTService implements DHTService {
|
||||
private static final Logger log = LoggerFactory.getLogger(TomP2PDHTService.class);
|
||||
public class TomP2PAddressService implements AddressService {
|
||||
private static final Logger log = LoggerFactory.getLogger(TomP2PAddressService.class);
|
||||
|
||||
private final TomP2PNode tomP2PNode;
|
||||
private final CopyOnWriteArrayList<MessageHandler> messageHandlers = new CopyOnWriteArrayList<>();
|
||||
@ -56,7 +56,7 @@ public class TomP2PDHTService implements DHTService {
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public TomP2PDHTService(TomP2PNode tomP2PNode) {
|
||||
public TomP2PAddressService(TomP2PNode tomP2PNode) {
|
||||
this.tomP2PNode = tomP2PNode;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ package io.bitsquare.network.tomp2p;
|
||||
|
||||
import io.bitsquare.network.BootstrapNodes;
|
||||
import io.bitsquare.network.ClientNode;
|
||||
import io.bitsquare.network.DHTService;
|
||||
import io.bitsquare.network.AddressService;
|
||||
import io.bitsquare.network.MessageService;
|
||||
import io.bitsquare.network.NetworkModule;
|
||||
import io.bitsquare.network.Node;
|
||||
@ -53,7 +53,7 @@ public class TomP2PNetworkModule extends NetworkModule {
|
||||
bind(ClientNode.class).to(TomP2PNode.class).in(Singleton.class);
|
||||
bind(TomP2PNode.class).in(Singleton.class);
|
||||
bind(MessageService.class).toProvider(TomP2PMessageServiceProvider.class).in(Singleton.class);
|
||||
bind(DHTService.class).toProvider(TomP2PDHTServiceProvider.class).in(Singleton.class);
|
||||
bind(AddressService.class).toProvider(TomP2PAddressServiceProvider.class).in(Singleton.class);
|
||||
|
||||
bind(int.class).annotatedWith(Names.named(Node.PORT_KEY)).toInstance(env.getProperty(Node.PORT_KEY, int.class, Node.DEFAULT_PORT));
|
||||
bind(boolean.class).annotatedWith(Names.named(USE_MANUAL_PORT_FORWARDING_KEY)).toInstance(
|
||||
@ -93,16 +93,16 @@ class TomP2PMessageServiceProvider implements Provider<MessageService> {
|
||||
}
|
||||
}
|
||||
|
||||
class TomP2PDHTServiceProvider implements Provider<DHTService> {
|
||||
private final DHTService dhtService;
|
||||
class TomP2PAddressServiceProvider implements Provider<AddressService> {
|
||||
private final AddressService addressService;
|
||||
|
||||
@Inject
|
||||
public TomP2PDHTServiceProvider(TomP2PNode tomP2PNode) {
|
||||
dhtService = new TomP2PDHTService(tomP2PNode);
|
||||
dhtService.setExecutor(Platform::runLater);
|
||||
public TomP2PAddressServiceProvider(TomP2PNode tomP2PNode) {
|
||||
addressService = new TomP2PAddressService(tomP2PNode);
|
||||
addressService.setExecutor(Platform::runLater);
|
||||
}
|
||||
|
||||
public DHTService get() {
|
||||
return dhtService;
|
||||
public AddressService get() {
|
||||
return addressService;
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ import io.bitsquare.common.handlers.ErrorMessageHandler;
|
||||
import io.bitsquare.common.handlers.ResultHandler;
|
||||
import io.bitsquare.crypto.SignatureService;
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
import io.bitsquare.network.DHTService;
|
||||
import io.bitsquare.network.AddressService;
|
||||
import io.bitsquare.network.Message;
|
||||
import io.bitsquare.network.MessageService;
|
||||
import io.bitsquare.network.Peer;
|
||||
@ -72,7 +72,7 @@ public class TradeManager {
|
||||
private final AccountSettings accountSettings;
|
||||
private final Persistence persistence;
|
||||
private final MessageService messageService;
|
||||
private final DHTService dhtService;
|
||||
private final AddressService addressService;
|
||||
private final BlockChainService blockChainService;
|
||||
private final WalletService walletService;
|
||||
private final SignatureService signatureService;
|
||||
@ -95,14 +95,14 @@ public class TradeManager {
|
||||
|
||||
@Inject
|
||||
public TradeManager(User user, AccountSettings accountSettings, Persistence persistence,
|
||||
MessageService messageService, DHTService dhtService, BlockChainService blockChainService,
|
||||
MessageService messageService, AddressService addressService, BlockChainService blockChainService,
|
||||
WalletService walletService, SignatureService signatureService,
|
||||
OfferBookService offerBookService) {
|
||||
this.user = user;
|
||||
this.accountSettings = accountSettings;
|
||||
this.persistence = persistence;
|
||||
this.messageService = messageService;
|
||||
this.dhtService = dhtService;
|
||||
this.addressService = addressService;
|
||||
this.blockChainService = blockChainService;
|
||||
this.walletService = walletService;
|
||||
this.signatureService = signatureService;
|
||||
@ -152,7 +152,7 @@ public class TradeManager {
|
||||
CheckOfferAvailabilityModel model = new CheckOfferAvailabilityModel(
|
||||
offer,
|
||||
messageService,
|
||||
dhtService);
|
||||
addressService);
|
||||
|
||||
CheckOfferAvailabilityProtocol protocol = new CheckOfferAvailabilityProtocol(model,
|
||||
() -> disposeCheckOfferAvailabilityRequest(offer),
|
||||
@ -215,7 +215,7 @@ public class TradeManager {
|
||||
}
|
||||
|
||||
public void requestTakeOffer(Coin amount, Offer offer, TradeResultHandler tradeResultHandler) {
|
||||
CheckOfferAvailabilityModel model = new CheckOfferAvailabilityModel(offer, messageService, dhtService);
|
||||
CheckOfferAvailabilityModel model = new CheckOfferAvailabilityModel(offer, messageService, addressService);
|
||||
CheckOfferAvailabilityProtocol protocol = new CheckOfferAvailabilityProtocol(model,
|
||||
() -> {
|
||||
disposeCheckOfferAvailabilityRequest(offer);
|
||||
|
@ -18,7 +18,7 @@
|
||||
package io.bitsquare.trade.protocol.availability;
|
||||
|
||||
import io.bitsquare.common.taskrunner.SharedTaskModel;
|
||||
import io.bitsquare.network.DHTService;
|
||||
import io.bitsquare.network.AddressService;
|
||||
import io.bitsquare.network.MessageService;
|
||||
import io.bitsquare.network.Peer;
|
||||
import io.bitsquare.offer.Offer;
|
||||
@ -32,15 +32,15 @@ public class CheckOfferAvailabilityModel extends SharedTaskModel {
|
||||
|
||||
public final Offer offer;
|
||||
public final MessageService messageService;
|
||||
public final DHTService dhtService;
|
||||
public final AddressService addressService;
|
||||
|
||||
private Peer peer;
|
||||
private OfferMessage message;
|
||||
|
||||
public CheckOfferAvailabilityModel(Offer offer, MessageService messageService, DHTService dhtService) {
|
||||
public CheckOfferAvailabilityModel(Offer offer, MessageService messageService, AddressService addressService) {
|
||||
this.offer = offer;
|
||||
this.messageService = messageService;
|
||||
this.dhtService = dhtService;
|
||||
this.addressService = addressService;
|
||||
}
|
||||
|
||||
public Peer getPeer() {
|
||||
|
@ -39,7 +39,7 @@ public class GetPeerAddress extends Task<CheckOfferAvailabilityModel> {
|
||||
@Override
|
||||
protected void doRun() {
|
||||
try {
|
||||
model.dhtService.findPeerAddress(model.offer.getMessagePublicKey(), new GetPeerAddressListener() {
|
||||
model.addressService.findPeerAddress(model.offer.getMessagePublicKey(), new GetPeerAddressListener() {
|
||||
@Override
|
||||
public void onResult(Peer peer) {
|
||||
model.setPeer(peer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user