summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPixel <Pixel>2001-11-30 00:03:10 +0000
committerPixel <Pixel>2001-11-30 00:03:10 +0000
commit68aeaf14ea2bc388b3d3c5d195fd3f5e983576c0 (patch)
treee776a0f936b7413b184ce34e205f4aca27f62b62 /lib
parent23d91060b557f77fc37e629a168ca810cd66a364 (diff)
Debugging...
Diffstat (limited to 'lib')
-rw-r--r--lib/Handle.cc9
-rw-r--r--lib/Socket.cc14
-rw-r--r--lib/TaskMan.cc8
3 files changed, 26 insertions, 5 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc
index 253ddbf..c02bc55 100644
--- a/lib/Handle.cc
+++ b/lib/Handle.cc
@@ -160,4 +160,11 @@ time_t Handle::GetModif(void) {
bool Handle::CanWatch(void) {
return true;
-} \ No newline at end of file
+}
+
+void Handle::Dup(const Handle & H) {
+ close();
+ if (H.h >= 0) {
+ h = dup(H.h);
+ }
+}
diff --git a/lib/Socket.cc b/lib/Socket.cc
index d3d7c19..f35bb72 100644
--- a/lib/Socket.cc
+++ b/lib/Socket.cc
@@ -122,3 +122,17 @@ Socket Socket::Accept(void) throw (GeneralException) {
return Socket(h);
}
}
+
+int Socket::GetPort() {
+ int r;
+ struct sockaddr_in localsocketaddr;
+ socklen_t locallen = sizeof(localsocketaddr);
+
+ if (getsockname(GetHandle(), (struct sockaddr *) &localsocketaddr, &locallen)) {
+ return -1;
+ }
+
+ r = ntohs(localsocketaddr.sin_port);
+
+ return r;
+}
diff --git a/lib/TaskMan.cc b/lib/TaskMan.cc
index f18bcf7..5709d02 100644
--- a/lib/TaskMan.cc
+++ b/lib/TaskMan.cc
@@ -147,7 +147,7 @@ void TaskMan::MainLoop() throw (GeneralException) {
if (stopped) return;
-// cerr << "-=- TaskMan: begin main loop with " << number << " task to manage.\n";
+ cerr << "-=- TaskMan: begin main loop with " << number << " task to manage.\n";
no_burst = 0;
while (!no_burst) {
@@ -157,7 +157,7 @@ void TaskMan::MainLoop() throw (GeneralException) {
Task * t = *p;
if (t->GetState() == TASK_BURST) {
-// cerr << "-=- TaskMan: running burning task " << t->GetName() << endl;
+ cerr << "-=- TaskMan: running burning task " << t->GetName() << endl;
t->Run();
/* if the task added some new tasks, we have to rerun the loop */
no_burst = 0;
@@ -274,7 +274,7 @@ void TaskMan::MainLoop() throw (GeneralException) {
touched = false;
if ((p->ha->GetHandle() == fd) && (!p->T->IsStopped()) && (p->T->GetState() != TASK_DONE) && (!p->dirthy)) {
// We've got one, launch it.
-// cerr << "-=- TaskMan: launching task " << p->T->GetName() << " for handle " << p->ha->GetHandle() << endl;
+ cerr << "-=- TaskMan: launching task " << p->T->GetName() << " for handle " << p->ha->GetHandle() << endl;
w4ha_t w4 = *p;
p->dirthy = true;
@@ -320,7 +320,7 @@ void TaskMan::MainLoop() throw (GeneralException) {
}
if ((o = t->WaitedBy())) {
-// cerr << "-=- TaskMan: running task " << o->GetName() << " for task " << t->GetName() << endl;
+ cerr << "-=- TaskMan: running task " << o->GetName() << " for task " << t->GetName() << endl;
o->Run();
if (o->GetState() == TASK_DONE) {