You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2005/11/23 17:06:16 UTC
svn commit: r348470 -
/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
Author: remm
Date: Wed Nov 23 08:06:10 2005
New Revision: 348470
URL: http://svn.apache.org/viewcvs?rev=348470&view=rev
Log:
- Fix crash when a socket is used outside of the process method (for example
through JMX). I would assume a crash would occur with a socket which had
its associated memory pool deallocated.
Modified:
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
Modified: tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=348470&r1=348469&r2=348470&view=diff
==============================================================================
--- tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java (original)
+++ tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java Wed Nov 23 08:06:10 2005
@@ -19,7 +19,6 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InterruptedIOException;
-import java.net.InetAddress;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -216,7 +215,7 @@
/**
* Socket associated with the current connection.
*/
- protected long socket;
+ protected long socket = 0;
/**
@@ -907,6 +906,7 @@
// Recycle
inputBuffer.recycle();
outputBuffer.recycle();
+ this.socket = 0;
return openSocket;
@@ -1003,7 +1003,7 @@
} else if (actionCode == ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE) {
// Get remote host address
- if (remoteAddr == null) {
+ if (remoteAddr == null && (socket != 0)) {
try {
long sa = Address.get(Socket.APR_REMOTE, socket);
remoteAddr = Address.getip(sa);
@@ -1016,7 +1016,7 @@
} else if (actionCode == ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE) {
// Get local host name
- if (localName == null) {
+ if (localName == null && (socket != 0)) {
try {
long sa = Address.get(Socket.APR_LOCAL, socket);
localName = Address.getnameinfo(sa, 0);
@@ -1029,7 +1029,7 @@
} else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) {
// Get remote host name
- if (remoteHost == null) {
+ if (remoteHost == null && (socket != 0)) {
try {
long sa = Address.get(Socket.APR_REMOTE, socket);
remoteHost = Address.getnameinfo(sa, 0);
@@ -1042,7 +1042,7 @@
} else if (actionCode == ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE) {
// Get local host address
- if (localAddr == null) {
+ if (localAddr == null && (socket != 0)) {
try {
long sa = Address.get(Socket.APR_LOCAL, socket);
Sockaddr addr = new Sockaddr();
@@ -1060,7 +1060,7 @@
} else if (actionCode == ActionCode.ACTION_REQ_REMOTEPORT_ATTRIBUTE) {
// Get remote port
- if (remotePort == -1) {
+ if (remotePort == -1 && (socket != 0)) {
try {
long sa = Address.get(Socket.APR_REMOTE, socket);
Sockaddr addr = Address.getInfo(sa);
@@ -1074,7 +1074,7 @@
} else if (actionCode == ActionCode.ACTION_REQ_LOCALPORT_ATTRIBUTE) {
// Get local port
- if (localPort == -1) {
+ if (localPort == -1 && (socket != 0)) {
try {
long sa = Address.get(Socket.APR_LOCAL, socket);
Sockaddr addr = new Sockaddr();
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org