/**
* Socket associated with the current connection.
*/
- protected NioChannel socket = null;
+ protected SocketWrapper<NioChannel> socket = null;
// --------------------------------------------------------- Public Methods
int keepAliveTimeout = endpoint.getKeepAliveTimeout();
RequestInfo rp = request.getRequestProcessor();
- final NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
+ final NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getSocket().getAttachment(false);
try {
rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
error = !adapter.event(request, response, status);
@Override
protected void resetTimeouts() {
- final NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
+ final NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getSocket().getAttachment(false);
if (!error && attach != null &&
asyncStateMachine.isAsyncDispatching()) {
long soTimeout = endpoint.getSoTimeout();
rp.setStage(org.apache.coyote.Constants.STAGE_PARSE);
// Setting up the socket
- this.socket = socket.getSocket();
- inputBuffer.setSocket(this.socket);
- outputBuffer.setSocket(this.socket);
+ this.socket = socket;
+ inputBuffer.setSocket(this.socket.getSocket());
+ outputBuffer.setSocket(this.socket.getSocket());
inputBuffer.setSelectorPool(((NioEndpoint)endpoint).getSelectorPool());
outputBuffer.setSelectorPool(((NioEndpoint)endpoint).getSelectorPool());
comet = false;
cometClose = true;
- SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector());
+ SelectionKey key = socket.getSocket().getIOChannel().keyFor(socket.getSocket().getPoller().getSelector());
if ( key != null ) {
NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment) key.attachment();
if ( attach!=null && attach.getComet()) {
// Get remote host address
if ((remoteAddr == null) && (socket != null)) {
- InetAddress inetAddr = socket.getIOChannel().socket().getInetAddress();
+ InetAddress inetAddr = socket.getSocket().getIOChannel().socket().getInetAddress();
if (inetAddr != null) {
remoteAddr = inetAddr.getHostAddress();
}
// Get local host name
if ((localName == null) && (socket != null)) {
- InetAddress inetAddr = socket.getIOChannel().socket().getLocalAddress();
+ InetAddress inetAddr = socket.getSocket().getIOChannel().socket().getLocalAddress();
if (inetAddr != null) {
localName = inetAddr.getHostName();
}
// Get remote host name
if ((remoteHost == null) && (socket != null)) {
- InetAddress inetAddr = socket.getIOChannel().socket().getInetAddress();
+ InetAddress inetAddr = socket.getSocket().getIOChannel().socket().getInetAddress();
if (inetAddr != null) {
remoteHost = inetAddr.getHostName();
}
} else if (actionCode == ActionCode.REQ_LOCAL_ADDR_ATTRIBUTE) {
if (localAddr == null)
- localAddr = socket.getIOChannel().socket().getLocalAddress().getHostAddress();
+ localAddr = socket.getSocket().getIOChannel().socket().getLocalAddress().getHostAddress();
request.localAddr().setString(localAddr);
} else if (actionCode == ActionCode.REQ_REMOTEPORT_ATTRIBUTE) {
if ((remotePort == -1 ) && (socket !=null)) {
- remotePort = socket.getIOChannel().socket().getPort();
+ remotePort = socket.getSocket().getIOChannel().socket().getPort();
}
request.setRemotePort(remotePort);
} else if (actionCode == ActionCode.REQ_LOCALPORT_ATTRIBUTE) {
if ((localPort == -1 ) && (socket !=null)) {
- localPort = socket.getIOChannel().socket().getLocalPort();
+ localPort = socket.getSocket().getIOChannel().socket().getLocalPort();
}
request.setLocalPort(localPort);
.setLimit(maxSavePostSize);
inputBuffer.addActiveFilter
(inputFilters[Constants.BUFFERED_FILTER]);
- SecureNioChannel sslChannel = (SecureNioChannel) socket;
+ SecureNioChannel sslChannel = (SecureNioChannel) socket.getSocket();
SSLEngine engine = sslChannel.getSslEngine();
if (!engine.getNeedClientAuth()) {
// Need to re-negotiate SSL connection
} else if (actionCode == ActionCode.COMET_END) {
comet = false;
} else if (actionCode == ActionCode.COMET_CLOSE) {
- if (socket==null || socket.getAttachment(false)==null) return;
- NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
+ if (socket==null || socket.getSocket().getAttachment(false)==null) return;
+ NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getSocket().getAttachment(false);
attach.setCometOps(NioEndpoint.OP_CALLBACK);
//notify poller if not on a tomcat thread
RequestInfo rp = request.getRequestProcessor();
if ( rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE ) //async handling
- socket.getPoller().add(socket);
+ socket.getSocket().getPoller().add(socket.getSocket());
} else if (actionCode == ActionCode.COMET_SETTIMEOUT) {
if (param==null) return;
- if (socket==null || socket.getAttachment(false)==null) return;
- NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
+ if (socket==null || socket.getSocket().getAttachment(false)==null) return;
+ NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getSocket().getAttachment(false);
long timeout = ((Long)param).longValue();
//if we are not piggy backing on a worker thread, set the timeout
RequestInfo rp = request.getRequestProcessor();
attach.setTimeout(timeout);
} else if (actionCode == ActionCode.ASYNC_COMPLETE) {
if (asyncStateMachine.asyncComplete()) {
- ((NioEndpoint)endpoint).processSocket(this.socket,
+ ((NioEndpoint)endpoint).processSocket(this.socket.getSocket(),
SocketStatus.OPEN, true);
}
} else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
if (param==null) return;
- if (socket==null || socket.getAttachment(false)==null) return;
- NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
+ if (socket==null || socket.getSocket().getAttachment(false)==null) return;
+ NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getSocket().getAttachment(false);
long timeout = ((Long)param).longValue();
//if we are not piggy backing on a worker thread, set the timeout
attach.setTimeout(timeout);
} else if (actionCode == ActionCode.ASYNC_DISPATCH) {
if (asyncStateMachine.asyncDispatch()) {
- ((NioEndpoint)endpoint).processSocket(this.socket,
+ ((NioEndpoint)endpoint).processSocket(this.socket.getSocket(),
SocketStatus.OPEN, true);
}
}