aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/threads/stroke_interface.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2006-10-27 10:46:56 +0000
committerMartin Willi <martin@strongswan.org>2006-10-27 10:46:56 +0000
commitebdddb74d4b7b3fe6b594358addc6d407cdd320a (patch)
treeeef88a1045b1a757b1e3f6351c7d45e72be5767a /src/charon/threads/stroke_interface.c
parentec92107923f7d74cdec3f4d209c3ed56ac011c8a (diff)
downloadstrongswan-ebdddb74d4b7b3fe6b594358addc6d407cdd320a.tar.bz2
strongswan-ebdddb74d4b7b3fe6b594358addc6d407cdd320a.tar.xz
some improvements in signaling code
Diffstat (limited to 'src/charon/threads/stroke_interface.c')
-rwxr-xr-xsrc/charon/threads/stroke_interface.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/charon/threads/stroke_interface.c b/src/charon/threads/stroke_interface.c
index 62d71dd95..0163f18a2 100755
--- a/src/charon/threads/stroke_interface.c
+++ b/src/charon/threads/stroke_interface.c
@@ -30,6 +30,7 @@
#include <dirent.h>
#include <errno.h>
#include <pthread.h>
+#include <signal.h>
#include "stroke_interface.h"
@@ -507,7 +508,7 @@ static void stroke_initiate(private_stroke_t *this, stroke_msg_t *msg)
connection->destroy(connection);
return;
}
-
+
policy = charon->policies->get_policy_by_name(charon->policies,
msg->initiate.name);
if (policy == NULL)
@@ -521,6 +522,14 @@ static void stroke_initiate(private_stroke_t *this, stroke_msg_t *msg)
}
job = initiate_job_create(connection, policy);
+ /*
+ if (msg->output_verbosity < 0)
+ {
+ TODO: detach immediately if verbosity is SILENT. Local credential store
+ is not threadsave yet, so this would cause crashes!!
+ charon->job_queue->add(charon->job_queue, (job_t*)job);
+ return;
+}*/
charon->bus->set_listen_state(charon->bus, TRUE);
charon->job_queue->add(charon->job_queue, (job_t*)job);
@@ -541,11 +550,11 @@ static void stroke_initiate(private_stroke_t *this, stroke_msg_t *msg)
fprintf(this->out, "\n") < 0 ||
fflush(this->out))
{
+ charon->bus->set_listen_state(charon->bus, FALSE);
break;
}
}
- /* TODO: Handle INVALID_KE_PAYLOAD signal (ike_sa switch) */
switch (signal)
{
case CHILD_UP_SUCCESS:
@@ -885,6 +894,10 @@ static void stroke_receive(private_stroke_t *this)
int strokefd;
int oldstate;
+ /* ignore sigpipe. writing over the pipe back to the console
+ * only fails if SIGPIPE is ignored. */
+ signal(SIGPIPE, SIG_IGN);
+
/* disable cancellation by default */
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);