Commit 179b35a2 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Added getPort() method (JM-623).

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3686 b35dd754-fafc-0310-a699-88a17e54d16e
parent 3c263498
...@@ -49,21 +49,28 @@ public interface Connection { ...@@ -49,21 +49,28 @@ public interface Connection {
*/ */
public InetAddress getInetAddress() throws UnknownHostException; public InetAddress getInetAddress() throws UnknownHostException;
/** /**
* Returns the Writer used to send data to the connection. The writer should be * Returns the port that the connection uses.
* used with caution. In the majority of cases, the {@link #deliver(Packet)} *
* method should be used to send data instead of using the writer directly. * @return the port that the connection uses.
* You must synchronize on the writer before writing data to it to ensure */
* data consistency: public int getPort();
*
* <pre> /**
* Writer writer = connection.getWriter(); * Returns the Writer used to send data to the connection. The writer should be
* synchronized(writer) { * used with caution. In the majority of cases, the {@link #deliver(Packet)}
* // write data.... * method should be used to send data instead of using the writer directly.
* }</pre> * You must synchronize on the writer before writing data to it to ensure
* * data consistency:
* @return the Writer for this connection. *
*/ * <pre>
* Writer writer = connection.getWriter();
* synchronized(writer) {
* // write data....
* }</pre>
*
* @return the Writer for this connection.
*/
public Writer getWriter(); public Writer getWriter();
/** /**
...@@ -254,7 +261,7 @@ public interface Connection { ...@@ -254,7 +261,7 @@ public interface Connection {
* compression is not available. Entities that request a compression negotiation * compression is not available. Entities that request a compression negotiation
* will get a stream error and their connections will be closed. * will get a stream error and their connections will be closed.
*/ */
disabled; disabled
} }
/** /**
...@@ -278,6 +285,6 @@ public interface Connection { ...@@ -278,6 +285,6 @@ public interface Connection {
* TLS is not available. Entities that request a TLS negotiation will get a stream * TLS is not available. Entities that request a TLS negotiation will get a stream
* error and their connections will be closed. * error and their connections will be closed.
*/ */
disabled; disabled
} }
} }
...@@ -229,6 +229,10 @@ public class SocketConnection implements Connection { ...@@ -229,6 +229,10 @@ public class SocketConnection implements Connection {
return socket.getInetAddress(); return socket.getInetAddress();
} }
public int getPort() {
return socket.getPort();
}
public Writer getWriter() { public Writer getWriter() {
return writer; return writer;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment