115 lines
3.2 KiB
Plaintext
115 lines
3.2 KiB
Plaintext
$OpenBSD: patch-libhttpd_src_select_h,v 1.1 2010/05/28 09:33:17 espie Exp $
|
|
--- libhttpd/src/select.h.orig Fri May 28 11:24:53 2010
|
|
+++ libhttpd/src/select.h Fri May 28 11:29:41 2010
|
|
@@ -81,8 +81,11 @@ class Clients { (protected)
|
|
c++;
|
|
}
|
|
|
|
- return 0;
|
|
+ return c;
|
|
}
|
|
+ ClientIterator notFound() {
|
|
+ return clientList.end();
|
|
+ }
|
|
|
|
|
|
public:
|
|
@@ -154,7 +157,7 @@ class Clients { (protected)
|
|
|
|
void erase( const int fDesc ) {
|
|
ClientIterator c;
|
|
- if ((c = locateFDesc(fDesc)) != 0) {
|
|
+ if ((c = locateFDesc(fDesc)) != notFound()) {
|
|
clientList.erase(c);
|
|
close(fDesc);
|
|
}
|
|
@@ -162,14 +165,14 @@ class Clients { (protected)
|
|
|
|
void finish( const int fDesc ) {
|
|
ClientIterator c;
|
|
- if ((c = locateFDesc(fDesc)) != 0) {
|
|
+ if ((c = locateFDesc(fDesc)) != notFound()) {
|
|
c->finished = true;
|
|
}
|
|
}
|
|
|
|
void address( const int fDesc, char address[HTTP_IP_ADDR_LEN] ) {
|
|
ClientIterator c;
|
|
- if ((c = locateFDesc(fDesc)) != 0) {
|
|
+ if ((c = locateFDesc(fDesc)) != notFound()) {
|
|
strncpy(address, c->address, HTTP_IP_ADDR_LEN);
|
|
}
|
|
}
|
|
@@ -180,7 +183,7 @@ class Clients { (protected)
|
|
|
|
int readBuf(const int fDesc, char *destBuf, const uint len) {
|
|
ClientIterator c;
|
|
- if ((c = locateFDesc(fDesc)) == 0) {
|
|
+ if ((c = locateFDesc(fDesc)) == notFound()) {
|
|
// printf("unknown client id %d\n", fDesc);
|
|
return 0;
|
|
}
|
|
@@ -192,7 +195,7 @@ class Clients { (protected)
|
|
|
|
int readLine(const int fDesc, char *destBuf, const uint len) {
|
|
ClientIterator c;
|
|
- if ((c = locateFDesc(fDesc)) == 0) {
|
|
+ if ((c = locateFDesc(fDesc)) == notFound()) {
|
|
// printf("unknown client id %d\n", fDesc);
|
|
return 0;
|
|
}
|
|
@@ -217,7 +220,7 @@ class Clients { (protected)
|
|
int handleWrite(int socket) {
|
|
int bytesWritten;
|
|
ClientIterator c;
|
|
- if ((c = locateFDesc(socket)) == 0) {
|
|
+ if ((c = locateFDesc(socket)) == notFound()) {
|
|
// printf("unknown client id %d\n", socket);
|
|
return 2;
|
|
}
|
|
@@ -260,7 +263,7 @@ class Clients { (protected)
|
|
return 1;
|
|
} else {
|
|
ClientIterator c;
|
|
- if ((c = locateFDesc(fDesc)) == 0) {
|
|
+ if ((c = locateFDesc(fDesc)) == notFound()) {
|
|
// printf("unknown client id %d\n", fDesc);
|
|
return 2;
|
|
}
|
|
@@ -304,7 +307,7 @@ class Clients { (protected)
|
|
|
|
void doWrite(const int fDesc, const char* string, const uint len) {
|
|
ClientIterator c;
|
|
- if ((c = locateFDesc(fDesc)) == 0) {
|
|
+ if ((c = locateFDesc(fDesc)) == notFound()) {
|
|
//printf("unknown client id %d\n", fDesc);
|
|
return;
|
|
}
|
|
@@ -318,7 +321,7 @@ class Clients { (protected)
|
|
|
|
void doWrite(const int fDesc, const char* string) {
|
|
ClientIterator c;
|
|
- if ((c = locateFDesc(fDesc)) == 0) {
|
|
+ if ((c = locateFDesc(fDesc)) == notFound()) {
|
|
//printf("unknown client id %d\n", fDesc);
|
|
return;
|
|
}
|
|
@@ -351,7 +354,7 @@ class Clients { (protected)
|
|
|
|
void queueFile(const int socket, const int pendingFile ) {
|
|
ClientIterator c;
|
|
- if ((c = locateFDesc(socket)) == 0) {
|
|
+ if ((c = locateFDesc(socket)) == notFound()) {
|
|
// printf("unknown client id %d\n", socket);
|
|
return;
|
|
}
|
|
@@ -360,7 +363,7 @@ class Clients { (protected)
|
|
|
|
void subscribe(const int fDesc) {
|
|
ClientIterator c;
|
|
- if ((c = locateFDesc(fDesc)) == 0) {
|
|
+ if ((c = locateFDesc(fDesc)) == notFound()) {
|
|
//printf("unknown client id %d\n", fDesc);
|
|
return;
|
|
}
|