Author: remm
Date: Thu Feb 16 05:22:51 2006
New Revision: 378241
URL: http://svn.apache.org/viewcvs?rev=378241view=rev
Log:
- Fix a dumb programming error which could cause a crash (rare, fortunately)
after a poll error.
i-- was used for the loop, so if sockets add were pending, the first socket
(position 0) would
be destroyed but not removed from the poller.
- Change syncing to sync on this, as init reallocates a new addS object.
Please review to make
sure all my syncs match my notify calls :)
Modified:
tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java
Modified:
tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java
URL:
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=378241r1=378240r2=378241view=diff
==
---
tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java
(original)
+++
tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java
Thu Feb 16 05:22:51 2006
@@ -985,7 +985,7 @@
*/
protected void destroy() {
// Close all sockets in the add queue
-for (int i = 0; i addCount; i--) {
+for (int i = 0; i addCount; i++) {
Socket.destroy(addS[i]);
}
// Close all sockets still in the poller
@@ -1009,7 +1009,7 @@
* @param socket to add to the poller
*/
public void add(long socket) {
-synchronized (addS) {
+synchronized (this) {
// Add socket to the list. Newly added sockets will wait
// at most for pollTime before being polled
if (addCount = addS.length) {
@@ -1019,7 +1019,7 @@
}
addS[addCount] = socket;
addCount++;
-addS.notify();
+this.notify();
}
}
@@ -1046,8 +1046,8 @@
// Reset maintain time.
maintainTime = 0;
try {
-synchronized (addS) {
-addS.wait();
+synchronized (this) {
+this.wait();
}
} catch (InterruptedException e) {
// Ignore
@@ -1057,7 +1057,7 @@
try {
// Add sockets which are waiting to the poller
if (addCount 0) {
-synchronized (addS) {
+synchronized (this) {
for (int i = (addCount - 1); i = 0; i--) {
int rv = Poll.add
(serverPollset, addS[i], Poll.APR_POLLIN);
@@ -1373,9 +1373,9 @@
}
// Add socket to the list. Newly added sockets will wait
// at most for pollTime before being polled
-synchronized (addS) {
+synchronized (this) {
addS.add(data);
-addS.notify();
+this.notify();
}
return false;
}
@@ -1413,8 +1413,8 @@
while (sendfileCount 1 addS.size() 1) {
try {
-synchronized (addS) {
-addS.wait();
+synchronized (this) {
+this.wait();
}
} catch (InterruptedException e) {
// Ignore
@@ -1424,7 +1424,7 @@
try {
// Add socket to the poller
if (addS.size() 0) {
-synchronized (addS) {
+synchronized (this) {
for (int i = (addS.size() - 1); i = 0; i--) {
SendfileData data = (SendfileData) addS.get(i);
int rv = Poll.add(sendfilePollset,
data.socket, Poll.APR_POLLOUT);
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]