⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 peerforeignnetworkconnection.java

📁 java 文件下载器。可自定义
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   PeerForeignNetworkConnection.java

package org.gudy.azureus2.pluginsimpl.local.peers;

import com.aelitis.azureus.core.networkmanager.*;
import com.aelitis.azureus.core.peermanager.messaging.*;
import java.io.IOException;
import java.net.InetSocketAddress;
import org.gudy.azureus2.core3.util.Debug;
import org.gudy.azureus2.core3.util.SystemTime;
import org.gudy.azureus2.plugins.peers.Peer;

public class PeerForeignNetworkConnection extends NetworkConnectionHelper
{
	protected class imq
		implements IncomingMessageQueue
	{

		final PeerForeignNetworkConnection this$0;

		public void setDecoder(MessageStreamDecoder messagestreamdecoder)
		{
		}

		public MessageStreamDecoder getDecoder()
		{
			throw new RuntimeException("Not imp");
		}

		public int getPercentDoneOfCurrentMessage()
		{
			return 0;
		}

		public int receiveFromTransport(int max_bytes)
			throws IOException
		{
			return peer.readBytes(max_bytes);
		}

		public void notifyOfExternallyReceivedMessage(Message message1)
		{
		}

		public void resumeQueueProcessing()
		{
		}

		public void registerQueueListener(com.aelitis.azureus.core.networkmanager.IncomingMessageQueue.MessageQueueListener messagequeuelistener)
		{
		}

		public void cancelQueueListener(com.aelitis.azureus.core.networkmanager.IncomingMessageQueue.MessageQueueListener messagequeuelistener)
		{
		}

		public void destroy()
		{
		}

		protected imq()
		{
			this$0 = PeerForeignNetworkConnection.this;
			super();
		}
	}

	protected class omq
		implements OutgoingMessageQueue
	{

		final PeerForeignNetworkConnection this$0;

		public void setTransport(Transport transport)
		{
		}

		public int getMssSize()
		{
			return PeerForeignNetworkConnection.this.getMssSize();
		}

		public void setEncoder(MessageStreamEncoder messagestreamencoder)
		{
		}

		public MessageStreamEncoder getEncoder()
		{
			throw new RuntimeException("Not imp");
		}

		public int getPercentDoneOfCurrentMessage()
		{
			return 0;
		}

		public void destroy()
		{
		}

		public void flush()
		{
		}

		public boolean isDestroyed()
		{
			return false;
		}

		public int getTotalSize()
		{
			return 0;
		}

		public boolean hasUrgentMessage()
		{
			return false;
		}

		public void addMessage(Message message, boolean manual_listener_notify)
		{
			throw new RuntimeException("Not imp");
		}

		public void removeMessagesOfType(Message message_types[], boolean manual_listener_notify)
		{
			throw new RuntimeException("Not imp");
		}

		public boolean removeMessage(Message message, boolean manual_listener_notify)
		{
			throw new RuntimeException("Not imp");
		}

		public int deliverToTransport(int max_bytes, boolean manual_listener_notify)
			throws IOException
		{
			throw new RuntimeException("Not imp");
		}

		public void doListenerNotifications()
		{
		}

		public void setTrace(boolean flag)
		{
		}

		public String getQueueTrace()
		{
			return "";
		}

		public void registerQueueListener(com.aelitis.azureus.core.networkmanager.OutgoingMessageQueue.MessageQueueListener messagequeuelistener)
		{
		}

		public void cancelQueueListener(com.aelitis.azureus.core.networkmanager.OutgoingMessageQueue.MessageQueueListener messagequeuelistener)
		{
		}

		public void notifyOfExternallySentMessage(Message message1)
		{
		}

		protected omq()
		{
			this$0 = PeerForeignNetworkConnection.this;
			super();
		}
	}

	protected class tp
		implements TransportBase
	{

		private long last_ready_for_read;
		final PeerForeignNetworkConnection this$0;

		public boolean isReadyForWrite(EventWaiter waiter)
		{
			return false;
		}

		public long isReadyForRead(EventWaiter waiter)
		{
			long now = SystemTime.getSteppedMonotonousTime();
			if (peer.isTransferAvailable())
			{
				last_ready_for_read = now;
				return 0L;
			} else
			{
				long diff = (now - last_ready_for_read) + 1L;
				return diff;
			}
		}

		public boolean isTCP()
		{
			return false;
		}

		public String getDescription()
		{
			return "Peer transport delegate";
		}

		protected tp()
		{
			this$0 = PeerForeignNetworkConnection.this;
			super();
			last_ready_for_read = SystemTime.getSteppedMonotonousTime();
		}
	}


	private ConnectionEndpoint endpoint;
	private Peer peer;
	private OutgoingMessageQueue outgoing_message_queue;
	private IncomingMessageQueue incoming_message_queue;
	private TransportBase transport_base;

	protected PeerForeignNetworkConnection(Peer _peer)
	{
		outgoing_message_queue = new omq();
		incoming_message_queue = new imq();
		transport_base = new tp();
		peer = _peer;
		endpoint = new ConnectionEndpoint(new InetSocketAddress(peer.getIp(), peer.getPort()));
	}

	public ConnectionEndpoint getEndpoint()
	{
		return endpoint;
	}

	public void notifyOfException(Throwable error)
	{
		Debug.printStackTrace(error);
	}

	public OutgoingMessageQueue getOutgoingMessageQueue()
	{
		return outgoing_message_queue;
	}

	public IncomingMessageQueue getIncomingMessageQueue()
	{
		return incoming_message_queue;
	}

	public TransportBase getTransportBase()
	{
		return transport_base;
	}

	public int getMssSize()
	{
		return NetworkManager.getMinMssSize();
	}

	public boolean isLANLocal()
	{
		return false;
	}

	public String getString()
	{
		String peer_str = peer.getClass().getName();
		int pos = peer_str.lastIndexOf('.');
		if (pos != -1)
			peer_str = peer_str.substring(pos + 1);
		peer_str = (new StringBuilder()).append(peer_str).append(" ").append(peer.getIp()).append(":").append(peer.getPort()).toString();
		return (new StringBuilder()).append("peer=").append(peer_str).append(",in=").append(incoming_message_queue.getPercentDoneOfCurrentMessage()).append(",out=").append(outgoing_message_queue.getTotalSize()).toString();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -