NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
if (attach != null) {
attach.setComet(comet);
- Integer comettimeout = (Integer) request.getAttribute("org.apache.tomcat.comet.timeout");
- if (comettimeout != null) attach.setTimeout(comettimeout.longValue());
+ if (comet) {
+ Integer comettimeout = (Integer) request.getAttribute("org.apache.tomcat.comet.timeout");
+ if (comettimeout != null) attach.setTimeout(comettimeout.longValue());
+ } else {
+ //reset the timeout
+ attach.setTimeout(endpoint.getSocketProperties().getSoTimeout());
+ }
+
}
}
} catch (InterruptedIOException e) {
NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment) key.attachment();
if (attach != null) {
attach.setComet(comet);
- Integer comettimeout = (Integer) request.getAttribute("org.apache.tomcat.comet.timeout");
- if (comettimeout != null) attach.setTimeout(comettimeout.longValue());
+ if (comet) {
+ Integer comettimeout = (Integer) request.getAttribute("org.apache.tomcat.comet.timeout");
+ if (comettimeout != null) attach.setTimeout(comettimeout.longValue());
+ }
}
}
} catch (InterruptedIOException e) {