mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 06:44:16 +00:00
Rename networkabstraction package to just net
This commit is contained in:
parent
c10ebd260c
commit
3318d15194
@ -48,8 +48,8 @@ import static com.google.common.base.Preconditions.checkState;
|
||||
* handles low-level message (de)serialization.</p>
|
||||
*
|
||||
* <p>Note that timeouts are handled by the extended
|
||||
* {@link com.google.bitcoin.networkabstraction.AbstractTimeoutHandler} and timeout is automatically disabled (using
|
||||
* {@link com.google.bitcoin.networkabstraction.AbstractTimeoutHandler#setTimeoutEnabled(boolean)}) once the version
|
||||
* {@link com.google.bitcoin.net.AbstractTimeoutHandler} and timeout is automatically disabled (using
|
||||
* {@link com.google.bitcoin.net.AbstractTimeoutHandler#setTimeoutEnabled(boolean)}) once the version
|
||||
* handshake completes.</p>
|
||||
*/
|
||||
public class Peer extends PeerSocketHandler {
|
||||
@ -148,9 +148,9 @@ public class Peer extends PeerSocketHandler {
|
||||
*
|
||||
* <p>Note that this does <b>NOT</b> make a connection to the given remoteAddress, it only creates a handler for a
|
||||
* connection. If you want to create a one-off connection, create a Peer and pass it to
|
||||
* {@link com.google.bitcoin.networkabstraction.NioClientManager#openConnection(java.net.SocketAddress, com.google.bitcoin.networkabstraction.StreamParser)}
|
||||
* {@link com.google.bitcoin.net.NioClientManager#openConnection(java.net.SocketAddress, com.google.bitcoin.net.StreamParser)}
|
||||
* or
|
||||
* {@link com.google.bitcoin.networkabstraction.NioClient#NioClient(java.net.SocketAddress, com.google.bitcoin.networkabstraction.StreamParser, int)}.</p>
|
||||
* {@link com.google.bitcoin.net.NioClient#NioClient(java.net.SocketAddress, com.google.bitcoin.net.StreamParser, int)}.</p>
|
||||
*
|
||||
* <p>The remoteAddress provided should match the remote address of the peer which is being connected to, and is
|
||||
* used to keep track of which peers relayed transactions and offer more descriptive logging.</p>
|
||||
@ -166,9 +166,9 @@ public class Peer extends PeerSocketHandler {
|
||||
*
|
||||
* <p>Note that this does <b>NOT</b> make a connection to the given remoteAddress, it only creates a handler for a
|
||||
* connection. If you want to create a one-off connection, create a Peer and pass it to
|
||||
* {@link com.google.bitcoin.networkabstraction.NioClientManager#openConnection(java.net.SocketAddress, com.google.bitcoin.networkabstraction.StreamParser)}
|
||||
* {@link com.google.bitcoin.net.NioClientManager#openConnection(java.net.SocketAddress, com.google.bitcoin.net.StreamParser)}
|
||||
* or
|
||||
* {@link com.google.bitcoin.networkabstraction.NioClient#NioClient(java.net.SocketAddress, com.google.bitcoin.networkabstraction.StreamParser, int)}.</p>
|
||||
* {@link com.google.bitcoin.net.NioClient#NioClient(java.net.SocketAddress, com.google.bitcoin.net.StreamParser, int)}.</p>
|
||||
*
|
||||
* <p>The remoteAddress provided should match the remote address of the peer which is being connected to, and is
|
||||
* used to keep track of which peers relayed transactions and offer more descriptive logging.</p>
|
||||
@ -196,9 +196,9 @@ public class Peer extends PeerSocketHandler {
|
||||
*
|
||||
* <p>Note that this does <b>NOT</b> make a connection to the given remoteAddress, it only creates a handler for a
|
||||
* connection. If you want to create a one-off connection, create a Peer and pass it to
|
||||
* {@link com.google.bitcoin.networkabstraction.NioClientManager#openConnection(java.net.SocketAddress, com.google.bitcoin.networkabstraction.StreamParser)}
|
||||
* {@link com.google.bitcoin.net.NioClientManager#openConnection(java.net.SocketAddress, com.google.bitcoin.net.StreamParser)}
|
||||
* or
|
||||
* {@link com.google.bitcoin.networkabstraction.NioClient#NioClient(java.net.SocketAddress, com.google.bitcoin.networkabstraction.StreamParser, int)}.</p>
|
||||
* {@link com.google.bitcoin.net.NioClient#NioClient(java.net.SocketAddress, com.google.bitcoin.net.StreamParser, int)}.</p>
|
||||
*
|
||||
* <p>The remoteAddress provided should match the remote address of the peer which is being connected to, and is
|
||||
* used to keep track of which peers relayed transactions and offer more descriptive logging.</p>
|
||||
|
@ -20,8 +20,8 @@ package com.google.bitcoin.core;
|
||||
import com.google.bitcoin.discovery.PeerDiscovery;
|
||||
import com.google.bitcoin.discovery.PeerDiscoveryException;
|
||||
import com.google.bitcoin.script.Script;
|
||||
import com.google.bitcoin.networkabstraction.ClientConnectionManager;
|
||||
import com.google.bitcoin.networkabstraction.NioClientManager;
|
||||
import com.google.bitcoin.net.ClientConnectionManager;
|
||||
import com.google.bitcoin.net.NioClientManager;
|
||||
import com.google.bitcoin.utils.ListenerRegistration;
|
||||
import com.google.bitcoin.utils.Threading;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
@ -24,9 +24,9 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.channels.NotYetConnectedException;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
import com.google.bitcoin.networkabstraction.AbstractTimeoutHandler;
|
||||
import com.google.bitcoin.networkabstraction.MessageWriteTarget;
|
||||
import com.google.bitcoin.networkabstraction.StreamParser;
|
||||
import com.google.bitcoin.net.AbstractTimeoutHandler;
|
||||
import com.google.bitcoin.net.MessageWriteTarget;
|
||||
import com.google.bitcoin.net.StreamParser;
|
||||
import com.google.bitcoin.utils.Threading;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import org.slf4j.Logger;
|
||||
@ -38,7 +38,7 @@ import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
/**
|
||||
* Handles high-level message (de)serialization for peers, acting as the bridge between the
|
||||
* {@link com.google.bitcoin.networkabstraction} classes and {@link Peer}.
|
||||
* {@link com.google.bitcoin.net} classes and {@link Peer}.
|
||||
*/
|
||||
public abstract class PeerSocketHandler extends AbstractTimeoutHandler implements StreamParser {
|
||||
private static final Logger log = LoggerFactory.getLogger(PeerSocketHandler.class);
|
||||
@ -184,8 +184,8 @@ public abstract class PeerSocketHandler extends AbstractTimeoutHandler implement
|
||||
|
||||
/**
|
||||
* Sets the {@link MessageWriteTarget} used to write messages to the peer. This should almost never be called, it is
|
||||
* called automatically by {@link com.google.bitcoin.networkabstraction.NioClient} or
|
||||
* {@link com.google.bitcoin.networkabstraction.NioClientManager} once the socket finishes initialization.
|
||||
* called automatically by {@link com.google.bitcoin.net.NioClient} or
|
||||
* {@link com.google.bitcoin.net.NioClientManager} once the socket finishes initialization.
|
||||
*/
|
||||
@Override
|
||||
public void setWriteTarget(MessageWriteTarget writeTarget) {
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.bitcoin.networkabstraction;
|
||||
package com.google.bitcoin.net;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.bitcoin.networkabstraction;
|
||||
package com.google.bitcoin.net;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.bitcoin.networkabstraction;
|
||||
package com.google.bitcoin.net;
|
||||
|
||||
import com.google.common.util.concurrent.AbstractIdleService;
|
||||
|
||||
@ -24,7 +24,6 @@ import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
/**
|
||||
* <p>A thin wrapper around a set of {@link BlockingClient}s.</p>
|
@ -14,11 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.bitcoin.networkabstraction;
|
||||
package com.google.bitcoin.net;
|
||||
|
||||
import com.google.common.util.concurrent.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.SocketAddress;
|
||||
|
||||
/**
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.bitcoin.networkabstraction;
|
||||
package com.google.bitcoin.net;
|
||||
|
||||
import com.google.bitcoin.core.Message;
|
||||
import com.google.bitcoin.utils.Threading;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.bitcoin.networkabstraction;
|
||||
package com.google.bitcoin.net;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -14,21 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.bitcoin.networkabstraction;
|
||||
package com.google.bitcoin.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.AsynchronousCloseException;
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.bitcoin.networkabstraction;
|
||||
package com.google.bitcoin.net;
|
||||
|
||||
import com.google.common.util.concurrent.AbstractExecutionThreadService;
|
||||
import org.slf4j.LoggerFactory;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.bitcoin.networkabstraction;
|
||||
package com.google.bitcoin.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.bitcoin.networkabstraction;
|
||||
package com.google.bitcoin.net;
|
||||
|
||||
import com.google.bitcoin.core.Utils;
|
||||
import com.google.bitcoin.utils.Threading;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.bitcoin.networkabstraction;
|
||||
package com.google.bitcoin.net;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.bitcoin.networkabstraction;
|
||||
package com.google.bitcoin.net;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import javax.annotation.Nullable;
|
@ -20,8 +20,8 @@ import com.google.bitcoin.core.ECKey;
|
||||
import com.google.bitcoin.core.InsufficientMoneyException;
|
||||
import com.google.bitcoin.core.Sha256Hash;
|
||||
import com.google.bitcoin.core.Wallet;
|
||||
import com.google.bitcoin.networkabstraction.NioClient;
|
||||
import com.google.bitcoin.networkabstraction.ProtobufParser;
|
||||
import com.google.bitcoin.net.NioClient;
|
||||
import com.google.bitcoin.net.ProtobufParser;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.SettableFuture;
|
||||
import org.bitcoin.paymentchannel.Protos;
|
||||
|
@ -27,9 +27,9 @@ import javax.annotation.Nullable;
|
||||
import com.google.bitcoin.core.Sha256Hash;
|
||||
import com.google.bitcoin.core.TransactionBroadcaster;
|
||||
import com.google.bitcoin.core.Wallet;
|
||||
import com.google.bitcoin.networkabstraction.NioServer;
|
||||
import com.google.bitcoin.networkabstraction.ProtobufParser;
|
||||
import com.google.bitcoin.networkabstraction.StreamParserFactory;
|
||||
import com.google.bitcoin.net.NioServer;
|
||||
import com.google.bitcoin.net.ProtobufParser;
|
||||
import com.google.bitcoin.net.StreamParserFactory;
|
||||
import org.bitcoin.paymentchannel.Protos;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
@ -19,7 +19,7 @@ package com.google.bitcoin.protocols.channels;
|
||||
import java.math.BigInteger;
|
||||
|
||||
import com.google.bitcoin.core.Sha256Hash;
|
||||
import com.google.bitcoin.networkabstraction.ProtobufParser;
|
||||
import com.google.bitcoin.net.ProtobufParser;
|
||||
import org.bitcoin.paymentchannel.Protos;
|
||||
|
||||
/**
|
||||
|
@ -22,6 +22,7 @@ import com.google.bitcoin.utils.Threading;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.SettableFuture;
|
||||
import com.google.common.util.concurrent.Uninterruptibles;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
package com.google.bitcoin.core;
|
||||
|
||||
import com.google.bitcoin.networkabstraction.*;
|
||||
import com.google.bitcoin.net.*;
|
||||
import com.google.bitcoin.params.UnitTestParams;
|
||||
import com.google.bitcoin.store.BlockStore;
|
||||
import com.google.bitcoin.store.MemoryBlockStore;
|
||||
@ -117,10 +117,8 @@ public class TestWithNetworkConnections {
|
||||
peer.addEventListener(new AbstractPeerEventListener() {
|
||||
@Override
|
||||
public void onPeerDisconnected(Peer p, int peerCount) {
|
||||
synchronized (doneConnecting) {
|
||||
if (!doneConnecting.get())
|
||||
thisThread.interrupt();
|
||||
}
|
||||
if (!doneConnecting.get())
|
||||
thisThread.interrupt();
|
||||
}
|
||||
});
|
||||
if (clientType == ClientType.NIO_CLIENT_MANAGER || clientType == ClientType.BLOCKING_CLIENT_MANAGER)
|
||||
@ -140,9 +138,7 @@ public class TestWithNetworkConnections {
|
||||
try {
|
||||
assertTrue(writeTarget.nextMessageBlocking() instanceof VersionMessage);
|
||||
assertTrue(writeTarget.nextMessageBlocking() instanceof VersionAck);
|
||||
synchronized (doneConnecting) {
|
||||
doneConnecting.set(true);
|
||||
}
|
||||
doneConnecting.set(true);
|
||||
} catch (InterruptedException e) {
|
||||
// We were disconnected before we got back version/verack
|
||||
}
|
||||
|
@ -17,8 +17,8 @@
|
||||
package com.google.bitcoin.core;
|
||||
|
||||
import com.google.bitcoin.params.UnitTestParams;
|
||||
import com.google.bitcoin.networkabstraction.BlockingClientManager;
|
||||
import com.google.bitcoin.networkabstraction.NioClientManager;
|
||||
import com.google.bitcoin.net.BlockingClientManager;
|
||||
import com.google.bitcoin.net.NioClientManager;
|
||||
import com.google.bitcoin.store.BlockStore;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
@ -14,9 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.bitcoin.networkabstraction;
|
||||
package com.google.bitcoin.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
@ -22,12 +22,10 @@ import com.google.bitcoin.core.Peer;
|
||||
import com.google.bitcoin.core.VersionMessage;
|
||||
import com.google.bitcoin.discovery.DnsDiscovery;
|
||||
import com.google.bitcoin.discovery.PeerDiscoveryException;
|
||||
import com.google.bitcoin.networkabstraction.NioClient;
|
||||
import com.google.bitcoin.networkabstraction.NioClientManager;
|
||||
import com.google.bitcoin.net.NioClientManager;
|
||||
import com.google.bitcoin.params.MainNetParams;
|
||||
import com.google.bitcoin.utils.BriefLogFormatter;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.util.concurrent.FutureCallback;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.SettableFuture;
|
||||
|
Loading…
Reference in New Issue
Block a user