[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/icecream-make-it-cool/services
From: Dirk Mueller <mueller () kde ! org>
Date: 2007-07-26 15:19:48
Message-ID: 1185463188.609841.2796.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 692915 by mueller:
- send jobs to a monitor non-blocking
- implement host blocking
M +2 -2 comm.cpp
M +6 -1 comm.h
M +18 -4 scheduler.cpp
--- branches/work/icecream-make-it-cool/services/comm.cpp #692914:692915
@@ -904,7 +904,7 @@
}
bool
-MsgChannel::send_msg (const Msg &m)
+MsgChannel::send_msg (const Msg &m, enum SendFlags flag)
{
if (instate == NEED_PROTO && !wait_for_protocol ())
return false;
@@ -921,7 +921,7 @@
uint32_t len = htonl (msgtogo - msgtogo_old - 4);
memcpy (msgbuf + msgtogo_old, &len, 4);
}
- return flush_writebuf (true /* blocking*/);
+ return flush_writebuf (flag == SendBlocking);
}
#include "getifaddrs.h"
--- branches/work/icecream-make-it-cool/services/comm.h #692914:692915
@@ -136,6 +136,11 @@
// our filedesc
int fd;
+ enum SendFlags {
+ SendBlocking = 0,
+ SendNonBlocking = 1<<0
+ };
+
// the minimum protocol version between me and him
int protocol;
@@ -146,7 +151,7 @@
// NULL <--> channel closed
Msg *get_msg(int timeout = 10);
// false <--> error (msg not send)
- bool send_msg (const Msg &);
+ bool send_msg (const Msg &, enum SendFlags = SendBlocking);
// return last error (0 == no error)
int error(void) {return 0;}
bool has_msg (void) const { return eof || instate == HAS_MSG; }
--- branches/work/icecream-make-it-cool/services/scheduler.cpp #692914:692915
@@ -229,6 +229,7 @@
// A subset of connected_hosts representing the compiler servers
static list<CS*> css;
+static list<string> block_css;
static unsigned int new_job_id;
static map<unsigned int, Job*> jobs;
@@ -357,7 +358,7 @@
{
it_old = it++; // handle_end removes it from monitors, so don't be clever
/* If we can't send it, don't be clever, simply close this monitor. */
- if (!(*it_old)->send_msg (*m))
+ if (!(*it_old)->send_msg (*m, MsgChannel::SendNonBlocking))
handle_end (*it_old, 0);
}
delete m;
@@ -1114,7 +1115,6 @@
return false;
std::ostream& dbg = trace();
- dbg << "login " << m->nodename << " protocol version: " << c->protocol;
CS *cs = static_cast<CS *>(c);
cs->remote_port = m->port;
@@ -1128,6 +1128,12 @@
cs->host_platform = m->host_platform;
cs->chroot_possible = m->chroot_possible;
cs->pick_new_id();
+
+ for (list<string>::const_iterator it = block_css.begin(); it != block_css.end(); ++it)
+ if (cs->name == *it)
+ return false;
+
+ dbg << "login " << m->nodename << " protocol version: " << c->protocol;
handle_monitor_stats( cs );
/* remove any other clients with the same IP, they must be stale */
@@ -1482,6 +1488,12 @@
break;
}
}
+ else if (cmd == "listblocks")
+ {
+ for (list<string>::const_iterator it = block_css.begin(); it != block_css.end(); ++it)
+ if(!c->send_msg (TextMsg (" " + (*it) ) ))
+ break;
+ }
else if (cmd == "listjobs")
{
for (map<unsigned int, Job*>::const_iterator it = jobs.begin();
@@ -1494,7 +1506,7 @@
handle_end (c, m);
return false;
}
- else if (cmd == "removecs")
+ else if (cmd == "removecs" || cmd == "blockcs")
{
if (l.empty()) {
if(!c->send_msg (TextMsg (string ("Sure. But which hosts?"))))
@@ -1505,6 +1517,8 @@
for (list<CS*>::iterator it = css.begin(); it != css.end(); ++it)
if ((*it)->nodename == *si || (*it)->name == *si)
{
+ if (cmd == "blockcs")
+ block_css.push_back((*it)->name);
if (c->send_msg (TextMsg (string ("removing host ") + *si)))
handle_end ( *it, 0);
break;
@@ -1547,7 +1561,7 @@
else if (cmd == "help")
{
if (!c->send_msg (TextMsg (
- "listcs\nlistjobs\nremovecs\ninternals\nhelp\nquit")))
+ "listcs\nlistblocks\nlistjobs\nremovecs\nblockcs\ninternals\nhelp\nquit")))
return false;
}
else
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic