struct program_client *
program_client_unix_create(const char *socket_path, const char *const *args,
- const struct program_client_parameters *params,
- bool noreply)
+ const struct program_client_parameters *params)
{
struct program_client_remote *prclient;
const char *label;
prclient->client.disconnect = program_client_remote_disconnect;
prclient->client.switch_ioloop = program_client_remote_switch_ioloop;
prclient->address = p_strdup(pool, socket_path);
- prclient->noreply = noreply;
+ prclient->noreply = params->no_reply;
return &prclient->client;
}
struct program_client *
program_client_net_create(const char *host, in_port_t port,
const char *const *args,
- const struct program_client_parameters *params,
- bool noreply)
+ const struct program_client_parameters *params)
{
struct program_client_remote *prclient;
const char *label;
prclient->address = p_strdup(pool, host);
prclient->port = port;
prclient->have_hostname = TRUE;
- prclient->noreply = noreply;
+ prclient->noreply = params->no_reply;
return &prclient->client;
}
program_client_net_create_ips(const struct ip_addr *ips, size_t ips_count,
in_port_t port,
const char *const *args,
- const struct program_client_parameters *params,
- bool noreply)
+ const struct program_client_parameters *params)
{
struct program_client_remote *prclient;
const char *label;
sizeof(struct ip_addr)*ips_count);
prclient->ips_count = ips_count;
prclient->port = port;
- prclient->noreply = noreply;
+ prclient->noreply = params->no_reply;
return &prclient->client;
}
int program_client_create(const char *uri, const char *const *args,
const struct program_client_parameters *params,
- bool noreply, struct program_client **pc_r,
- const char **error_r)
+ struct program_client **pc_r, const char **error_r)
{
const char *suffix;
*pc_r = program_client_local_create(suffix, args, params);
return 0;
} else if (str_begins(uri, "unix:", &suffix)) {
- *pc_r = program_client_unix_create(suffix, args, params, noreply);
+ *pc_r = program_client_unix_create(suffix, args, params);
return 0;
} else if (str_begins(uri, "tcp:", &suffix)) {
const char *host;
"must be host:port in '%s'", suffix);
return -1;
}
- *pc_r = program_client_net_create(host, port, args, params,
- noreply);
+ *pc_r = program_client_net_create(host, port, args, params);
return 0;
} else {
*error_r = t_strdup_printf(
enabled for 'net' program clients, which may likely encounter
unexpected connection termination. */
bool use_dotstream:1;
+ bool no_reply:1;
};
typedef void program_client_fd_callback_t(void *context, struct istream *input);
ATTR_NULL(3);
struct program_client *
program_client_unix_create(const char *socket_path, const char *const *args,
- const struct program_client_parameters *params,
- bool noreply) ATTR_NULL(3);
+ const struct program_client_parameters *params);
struct program_client *
program_client_net_create(const char *host, in_port_t port,
const char *const *args,
- const struct program_client_parameters *params,
- bool noreply) ATTR_NULL(4);
+ const struct program_client_parameters *params);
struct program_client *
program_client_net_create_ips(const struct ip_addr *ips, size_t ips_count,
in_port_t port, const char *const *args,
- const struct program_client_parameters *params,
- bool noreply) ATTR_NULL(5);
+ const struct program_client_parameters *params);
int program_client_create(const char *uri, const char *const *args,
const struct program_client_parameters *params,
- bool noreply, struct program_client **pc_r,
- const char **error_r) ATTR_NULL(3);
+ struct program_client **pc_r, const char **error_r);
void program_client_destroy(struct program_client **_pclient);
test_begin("test_program_success");
+ pc_params.no_reply = FALSE;
pc = program_client_net_create("127.0.0.1", test_globals.port, args,
- &pc_params, FALSE);
+ &pc_params);
buffer_t *output = buffer_create_dynamic(default_pool, 16);
struct ostream *os = test_ostream_create(output);
struct program_client *pc;
int ret = -2;
+ pc_params.no_reply = FALSE;
pc = program_client_net_create("127.0.0.1", test_globals.port, args,
- &pc_params, FALSE);
+ &pc_params);
struct istream *is = test_istream_create(pclient_test_io_string);
program_client_set_input(pc, is);
test_begin("test_program_failure");
+ pc_params.no_reply = FALSE;
pc = program_client_net_create("127.0.0.1", test_globals.port, args,
- &pc_params, FALSE);
+ &pc_params);
buffer_t *output = buffer_create_dynamic(default_pool, 16);
struct ostream *os = test_ostream_create(output);
test_begin("test_program_noreply");
+ pc_params.no_reply = TRUE;
pc = program_client_net_create("127.0.0.1", test_globals.port, args,
- &pc_params, TRUE);
+ &pc_params);
program_client_run_async(pc, test_program_async_callback, &ret);
i_fatal("Cannot convert addresses");
}
+ pc_params.no_reply = TRUE;
pc = program_client_net_create_ips(ips, N_ELEMENTS(ips),
test_globals.port, args,
- &pc_params, TRUE);
+ &pc_params);
test_expect_errors(N_ELEMENTS(ips)-1);
program_client_run_async(pc, test_program_async_callback, &ret);
test_begin("test_program_success");
- pc = program_client_unix_create(TEST_SOCKET, args, &pc_params, FALSE);
+ pc_params.no_reply = FALSE;
+ pc = program_client_unix_create(TEST_SOCKET, args, &pc_params);
buffer_t *output = buffer_create_dynamic(default_pool, 16);
struct ostream *os = test_ostream_create(output);
struct program_client *pc;
int ret;
- pc = program_client_unix_create(TEST_SOCKET, args, &pc_params, FALSE);
+ pc_params.no_reply = FALSE;
+ pc = program_client_unix_create(TEST_SOCKET, args, &pc_params);
struct istream *is = test_istream_create(pclient_test_io_string);
program_client_set_input(pc, is);
test_begin("test_program_failure");
- pc = program_client_unix_create(TEST_SOCKET, args, &pc_params, FALSE);
+ pc_params.no_reply = FALSE;
+ pc = program_client_unix_create(TEST_SOCKET, args, &pc_params);
buffer_t *output = buffer_create_dynamic(default_pool, 16);
struct ostream *os = test_ostream_create(output);
test_begin("test_program_noreply");
- pc = program_client_unix_create(TEST_SOCKET, args, &pc_params, TRUE);
+ pc_params.no_reply = TRUE;
+ pc = program_client_unix_create(TEST_SOCKET, args, &pc_params);
program_client_run_async(pc, test_program_async_callback, &ret);
test_begin("test_program_sync");
- pc = program_client_unix_create(TEST_SOCKET, args, &pc_params, TRUE);
+ pc_params.no_reply = TRUE;
+ pc = program_client_unix_create(TEST_SOCKET, args, &pc_params);
ret = program_client_run(pc);
test_assert(ret == 1);
test_begin("test_program_async_wait");
+ pc_params.no_reply = TRUE;
test_globals.async_client = program_client_unix_create(TEST_SOCKET,
- args, &pc_params, TRUE);
+ args, &pc_params);
program_client_run_async(test_globals.async_client,
test_program_async_wait_finish,
struct program_client_parameters params = {
.client_connect_timeout_msecs = 1000,
.event = root->quota->event,
+ .no_reply = TRUE,
};
struct program_client *pc;
args++;
- if (program_client_create(socket_path, args, ¶ms, TRUE,
+ if (program_client_create(socket_path, args, ¶ms,
&pc, &error) < 0) {
e_error(root->quota->event,
"program_client_create(%s) failed: %s", socket_path,
struct program_client_parameters params = {
.client_connect_timeout_msecs = 1000,
.event = user->event,
+ .no_reply = !wait,
};
e_debug(user->event, "welcome: Executing %s (wait=%d)", cmd, wait ? 1 : 0);
}
struct welcome_client_list *wclient = i_new(struct welcome_client_list, 1);
- wclient->client = program_client_unix_create(socket_path, args, ¶ms, !wait);
+ wclient->client = program_client_unix_create(socket_path, args, ¶ms);
if (wait) {
enum program_client_exit_status ret =