i_assert(plclient->pid == status->pid);
+ e_debug(pclient->event, "Child process ended");
+
plclient->status = status->status;
plclient->exited = TRUE;
plclient->pid = -1;
}
/* parent */
+ e_debug(pclient->event, "Forked child process");
+
program_client_set_label(pclient,
t_strdup_printf("exec:%s (%d)", plclient->bin_path,
plclient->pid));
if (plclient->pid < 0)
return;
+ e_debug(pclient->event, "Sending SIGKILL signal to program");
+
/* kill it brutally now: it should die right away */
if (kill(plclient->pid, SIGKILL) < 0) {
e_error(pclient->event,
/* make sure it hasn't already been reaped */
if (waitpid(plclient->pid, &plclient->status, WNOHANG) > 0) {
+ e_debug(pclient->event, "Child process ended");
program_client_local_exited(plclient);
return;
}
return;
}
+ e_debug(pclient->event, "DNS lookup successful; got %d IPs",
+ result->ips_count);
+
/* reduce timeout */
if (pclient->set.client_connect_timeout_msecs > 0) {
if (pclient->set.client_connect_timeout_msecs <= result->msecs) {
} else {
prclient->resolved = FALSE;
if (pclient->set.dns_client_socket_path != NULL) {
+ e_debug(pclient->event,
+ "Performing asynchronous DNS lookup");
prclient->dns_set.dns_client_socket_path =
pclient->set.dns_client_socket_path;
prclient->dns_set.timeout_msecs =
prclient->ips_count = ips_count;
prclient->ips = p_memdup(pclient->pool,
ips, sizeof(*ips)*ips_count);
+
+ e_debug(pclient->event,
+ "DNS lookup successful; got %d IPs",
+ ips_count);
}
}
#include "ioloop.h"
#include "array.h"
#include "str.h"
+#include "str-sanitize.h"
#include "safe-mkstemp.h"
#include "istream-private.h"
#include "ostream-dot.h"
static int
program_client_connect(struct program_client *pclient)
{
+ e_debug(pclient->event, "Establishing connection");
+
if (pclient->set.client_connect_timeout_msecs != 0) {
pclient->to = timeout_add(
pclient->set.client_connect_timeout_msecs,
program_client_disconnect_extra_fds(pclient);
+ if (!pclient->disconnected)
+ e_debug(pclient->event, "Disconnected");
pclient->disconnected = TRUE;
}
if (pclient->error != PROGRAM_CLIENT_ERROR_NONE)
return;
+ e_debug(pclient->event, "Failed to run program");
+
pclient->error = error;
program_client_disconnect(pclient, TRUE);
}
static void
program_client_output_finished(struct program_client *pclient)
{
+ e_debug(pclient->event, "Finished input to program");
+
/* check whether program i/o is finished */
if (!program_client_input_pending(pclient)) {
/* finished */
iostream_pump_destroy(&pclient->pump_out);
+ e_debug(pclient->event, "Finished streaming payload to program");
+
o_stream_set_flush_callback(pclient->program_output,
program_client_output_finish, pclient);
o_stream_set_flush_pending(pclient->program_output, TRUE);
static void
program_client_input_finished(struct program_client *pclient)
{
+ e_debug(pclient->event, "Finished output from program");
+
/* check whether program i/o is finished */
if (program_client_input_pending(pclient))
return;
iostream_pump_destroy(&pclient->pump_in);
+ e_debug(pclient->event, "Finished streaming payload from program");
+
if (pclient->program_input != pclient->raw_program_input) {
/* return to raw program input */
i_stream_unref(&pclient->program_input);
void program_client_connected(struct program_client *pclient)
{
+ e_debug(pclient->event, "Connected to program");
+
/* finish creating program input */
if (pclient->raw_program_input != NULL) {
struct istream *input = pclient->raw_program_input;
if ((set != NULL && set->debug))
event_set_forced_debug(pclient->event, TRUE);
program_client_set_label(pclient, initial_label);
+
+ e_debug(pclient->event, "Created");
}
void program_client_set_input(struct program_client *pclient,
env = p_strdup_printf(pclient->pool, "%s=%s", name, value);
array_append(&pclient->envs, &env, 1);
+
+ e_debug(pclient->event, "Pass environment: %s",
+ str_sanitize(env, 256));
}
void program_client_init_streams(struct program_client *pclient)
*_pclient = NULL;
+ e_debug(pclient->event, "Destroy");
+
pclient->destroying = TRUE;
pclient->callback = NULL;