* [Cluster-devel] conga/ricci/ricci Server.cpp
@ 2006-10-14 17:53 kupcevic
0 siblings, 0 replies; 4+ messages in thread
From: kupcevic @ 2006-10-14 17:53 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Changes by: kupcevic at sourceware.org 2006-10-14 17:53:28
Modified files:
ricci/ricci : Server.cpp
Log message:
ricci: make server socket non-blocking (all sockets are non-blocking now)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/Server.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5
--- conga/ricci/ricci/Server.cpp 2006/08/10 22:53:09 1.4
+++ conga/ricci/ricci/Server.cpp 2006/10/14 17:53:27 1.5
@@ -57,7 +57,9 @@
Server::Server(const ServerSocket& serv_sock) :
_server(serv_sock)
-{}
+{
+ _server.nonblocking(true);
+}
Server::~Server()
{}
^ permalink raw reply [flat|nested] 4+ messages in thread* [Cluster-devel] conga/ricci/ricci Server.cpp
@ 2007-08-21 21:25 rmccabe
0 siblings, 0 replies; 4+ messages in thread
From: rmccabe @ 2007-08-21 21:25 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL5
Changes by: rmccabe at sourceware.org 2007-08-21 21:25:22
Modified files:
ricci/ricci : Server.cpp
Log message:
Block a DoS attack that could be used to cause ricci to deny legitimate connections.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/Server.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5&r2=1.5.2.1
--- conga/ricci/ricci/Server.cpp 2006/10/14 17:53:27 1.5
+++ conga/ricci/ricci/Server.cpp 2007/08/21 21:25:22 1.5.2.1
@@ -48,6 +48,7 @@
+static time_t last_purge = 0;
static bool shutdown_pending = false;
static void shutdown(int);
@@ -86,8 +87,10 @@
poll_data.revents = 0;
// wait for events
- int ret = poll(&poll_data, 1, 500);
- if (ret == 0) {
+ int ret = poll(&poll_data, 1, 1000);
+ time_t cur_time = time(NULL);
+ if (ret == 0 || cur_time - last_purge >= 2) {
+ last_purge = cur_time;
// clean up clients
list<list<counting_auto_ptr<ClientInstance> >::iterator> remove_us;
for (list<counting_auto_ptr<ClientInstance> >::iterator iter = clients.begin();
@@ -102,14 +105,16 @@
clients.erase(*iter);
cout << "client removed" << endl;
}
-
+ }
+
+ if (ret == 0) {
// continue waiting
continue;
} else if (ret == -1) {
if (errno == EINTR)
continue;
else
- throw String("poll() error");
+ throw String("poll() error: " + String(strerror(errno)));
}
// process events
@@ -117,8 +122,7 @@
try {
ClientSocket sock = _server.accept();
counting_auto_ptr<ClientInstance>
- client(new ClientInstance(sock,
- _dbus_controller));
+ client(new ClientInstance(sock, _dbus_controller));
client->start();
clients.push_back(client);
cout << "client added" << endl;
^ permalink raw reply [flat|nested] 4+ messages in thread* [Cluster-devel] conga/ricci/ricci Server.cpp
@ 2007-08-21 21:26 rmccabe
0 siblings, 0 replies; 4+ messages in thread
From: rmccabe @ 2007-08-21 21:26 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL4
Changes by: rmccabe at sourceware.org 2007-08-21 21:26:31
Modified files:
ricci/ricci : Server.cpp
Log message:
Block a DoS attack that could be used to cause ricci to deny legitimate connections.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/Server.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5&r2=1.5.4.1
--- conga/ricci/ricci/Server.cpp 2006/10/14 17:53:27 1.5
+++ conga/ricci/ricci/Server.cpp 2007/08/21 21:26:31 1.5.4.1
@@ -48,6 +48,7 @@
+static time_t last_purge = 0;
static bool shutdown_pending = false;
static void shutdown(int);
@@ -86,8 +87,10 @@
poll_data.revents = 0;
// wait for events
- int ret = poll(&poll_data, 1, 500);
- if (ret == 0) {
+ int ret = poll(&poll_data, 1, 1000);
+ time_t cur_time = time(NULL);
+ if (ret == 0 || cur_time - last_purge >= 2) {
+ last_purge = cur_time;
// clean up clients
list<list<counting_auto_ptr<ClientInstance> >::iterator> remove_us;
for (list<counting_auto_ptr<ClientInstance> >::iterator iter = clients.begin();
@@ -102,14 +105,16 @@
clients.erase(*iter);
cout << "client removed" << endl;
}
-
+ }
+
+ if (ret == 0) {
// continue waiting
continue;
} else if (ret == -1) {
if (errno == EINTR)
continue;
else
- throw String("poll() error");
+ throw String("poll() error: " + String(strerror(errno)));
}
// process events
@@ -117,8 +122,7 @@
try {
ClientSocket sock = _server.accept();
counting_auto_ptr<ClientInstance>
- client(new ClientInstance(sock,
- _dbus_controller));
+ client(new ClientInstance(sock, _dbus_controller));
client->start();
clients.push_back(client);
cout << "client added" << endl;
^ permalink raw reply [flat|nested] 4+ messages in thread* [Cluster-devel] conga/ricci/ricci Server.cpp
@ 2007-08-21 21:26 rmccabe
0 siblings, 0 replies; 4+ messages in thread
From: rmccabe @ 2007-08-21 21:26 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-08-21 21:26:49
Modified files:
ricci/ricci : Server.cpp
Log message:
Block a DoS attack that could be used to cause ricci to deny legitimate connections.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/Server.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6
--- conga/ricci/ricci/Server.cpp 2006/10/14 17:53:27 1.5
+++ conga/ricci/ricci/Server.cpp 2007/08/21 21:26:49 1.6
@@ -48,6 +48,7 @@
+static time_t last_purge = 0;
static bool shutdown_pending = false;
static void shutdown(int);
@@ -86,8 +87,10 @@
poll_data.revents = 0;
// wait for events
- int ret = poll(&poll_data, 1, 500);
- if (ret == 0) {
+ int ret = poll(&poll_data, 1, 1000);
+ time_t cur_time = time(NULL);
+ if (ret == 0 || cur_time - last_purge >= 2) {
+ last_purge = cur_time;
// clean up clients
list<list<counting_auto_ptr<ClientInstance> >::iterator> remove_us;
for (list<counting_auto_ptr<ClientInstance> >::iterator iter = clients.begin();
@@ -102,14 +105,16 @@
clients.erase(*iter);
cout << "client removed" << endl;
}
-
+ }
+
+ if (ret == 0) {
// continue waiting
continue;
} else if (ret == -1) {
if (errno == EINTR)
continue;
else
- throw String("poll() error");
+ throw String("poll() error: " + String(strerror(errno)));
}
// process events
@@ -117,8 +122,7 @@
try {
ClientSocket sock = _server.accept();
counting_auto_ptr<ClientInstance>
- client(new ClientInstance(sock,
- _dbus_controller));
+ client(new ClientInstance(sock, _dbus_controller));
client->start();
clients.push_back(client);
cout << "client added" << endl;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-08-21 21:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-14 17:53 [Cluster-devel] conga/ricci/ricci Server.cpp kupcevic
-- strict thread matches above, loose matches on Subject: below --
2007-08-21 21:25 rmccabe
2007-08-21 21:26 rmccabe
2007-08-21 21:26 rmccabe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).