Addition of NetClient isConnected method.
This commit is contained in:
		@@ -37,7 +37,7 @@ public class ExecuteThread<E extends NetClient> implements Runnable
 | 
			
		||||
				// Iterate client pool.
 | 
			
		||||
				ITERATE: for (E client : _pool)
 | 
			
		||||
				{
 | 
			
		||||
					if (client.getSocket() == null)
 | 
			
		||||
					if (!client.isConnected())
 | 
			
		||||
					{
 | 
			
		||||
						_pool.remove(client);
 | 
			
		||||
						continue ITERATE;
 | 
			
		||||
 
 | 
			
		||||
@@ -219,6 +219,15 @@ public class NetClient
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Checks if the connection is established.
 | 
			
		||||
	 * @return {@code true} if the socket is not {@code null} and therefore assumed to be connected, {@code false} otherwise.
 | 
			
		||||
	 */
 | 
			
		||||
	public boolean isConnected()
 | 
			
		||||
	{
 | 
			
		||||
		return _socket != null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the Socket of this client.
 | 
			
		||||
	 */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
package org.l2jmobius.commons.network;
 | 
			
		||||
 | 
			
		||||
import java.io.OutputStream;
 | 
			
		||||
import java.net.Socket;
 | 
			
		||||
import java.util.Queue;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
@@ -36,8 +35,7 @@ public class SendThread<E extends NetClient> implements Runnable
 | 
			
		||||
				// Iterate client pool.
 | 
			
		||||
				ITERATE: for (E client : _pool)
 | 
			
		||||
				{
 | 
			
		||||
					final Socket socket = client.getSocket();
 | 
			
		||||
					if (socket == null)
 | 
			
		||||
					if (!client.isConnected())
 | 
			
		||||
					{
 | 
			
		||||
						_pool.remove(client);
 | 
			
		||||
						continue ITERATE;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user