connection.c revision d951320d498ae0800b677b754dde71574102123b
/* Copyright (c) 2013-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "iostream.h"
#include "net.h"
#include "strescape.h"
#include "llist.h"
#include "time-util.h"
#include "connection.h"
#include <unistd.h>
{
}
{
}
{
const char *line;
int ret = 0;
switch (connection_input_read(conn)) {
case -1:
return;
case 0: /* allow calling this function for buffered input */
case 1:
break;
default:
i_unreached();
}
}
T_BEGIN {
} T_END;
if (ret <= 0)
break;
}
}
}
}
const char *const *args)
{
unsigned int recv_major_version;
/* VERSION <tab> service_name <tab> major version <tab> minor version */
i_error("%s didn't reply with a valid VERSION line",
return -1;
}
i_error("%s: Connected to wrong socket type. "
return -1;
}
i_error("%s: Socket supports major version %u, "
"but we support only %u (mixed old and new binaries?)",
return -1;
}
return 0;
}
{
const char *const *args;
if (!conn->version_received) {
return -1;
return 1;
}
}
{
if (set->input_max_size != 0) {
} else {
}
if (set->output_max_size != 0) {
}
if (set->input_idle_timeout_secs != 0) {
}
}
}
{
if (success)
if (!success) {
}
}
{
}
struct connection *conn,
{
}
{
}
{
}
{
}
{
int fd;
else
if (fd == -1)
return -1;
if (set->client_connect_timeout_msecs != 0) {
}
} else {
}
return 0;
}
{
conn->last_input = 0;
}
}
}
}
{
}
{
case -2:
/* buffer full */
return -1;
return -2;
}
i_unreached();
case -1:
/* disconnected */
return -1;
case 0:
/* nothing new read */
return 0;
default:
/* something was read */
return 1;
}
}
{
switch (conn->disconnect_reason) {
return "Deinitializing";
unsigned int msecs =
return t_strdup_printf("connect() timed out in %u.%03u secs",
}
return "Idle timeout";
return t_strdup_printf("connect() failed: %m");
/* fall through */
}
i_unreached();
}
{
return t_strdup_printf("No input for %u.%03u secs",
return t_strdup_printf(
"No input since connected %u.%03u secs ago",
} else {
return t_strdup_printf("connect() timed out after %u.%03u secs",
}
}
{
}
struct connection_list *
const struct connection_vfuncs *vfuncs)
{
struct connection_list *list;
return list;
}
{
struct connection *conn;
}
}