This member is initialized, but nothing ever reads it, so get rid of it.
uint32_t local_ip;
uint16_t local_port;
char *name;
- bool reconnectable;
};
void vconn_init(struct vconn *, struct vconn_class *, int connect_status,
- const char *name, bool reconnectable);
+ const char *name);
void vconn_set_remote_ip(struct vconn *, uint32_t remote_ip);
void vconn_set_remote_port(struct vconn *, uint16_t remote_port);
void vconn_set_local_ip(struct vconn *, uint32_t local_ip);
/* Create and return the ssl_vconn. */
sslv = xmalloc(sizeof *sslv);
- vconn_init(&sslv->vconn, &ssl_vconn_class, EAGAIN, name, true);
+ vconn_init(&sslv->vconn, &ssl_vconn_class, EAGAIN, name);
vconn_set_remote_ip(&sslv->vconn, remote->sin_addr.s_addr);
vconn_set_remote_port(&sslv->vconn, remote->sin_port);
vconn_set_local_ip(&sslv->vconn, local.sin_addr.s_addr);
int
new_stream_vconn(const char *name, int fd, int connect_status,
- bool reconnectable, struct vconn **vconnp)
+ struct vconn **vconnp)
{
struct stream_vconn *s;
s = xmalloc(sizeof *s);
- vconn_init(&s->vconn, &stream_vconn_class, connect_status,
- name, reconnectable);
+ vconn_init(&s->vconn, &stream_vconn_class, connect_status, name);
s->fd = fd;
s->txbuf = NULL;
s->tx_waiter = NULL;
struct sockaddr;
int new_stream_vconn(const char *name, int fd, int connect_status,
- bool reconnectable, struct vconn **vconnp);
+ struct vconn **vconnp);
int new_pstream_pvconn(const char *name, int fd,
int (*accept_cb)(int fd, const struct sockaddr *,
size_t sa_len, struct vconn **),
return errno;
}
- retval = new_stream_vconn(name, fd, connect_status, true, vconnp);
+ retval = new_stream_vconn(name, fd, connect_status, vconnp);
if (!retval) {
struct vconn *vconn = *vconnp;
vconn_set_remote_ip(vconn, remote->sin_addr.s_addr);
}
return new_stream_vconn(name, fd, check_connection_completion(fd),
- true, vconnp);
+ vconnp);
}
struct vconn_class unix_vconn_class = {
} else {
strcpy(name, "unix");
}
- return new_stream_vconn(name, fd, 0, true, vconnp);
+ return new_stream_vconn(name, fd, 0, vconnp);
}
struct pvconn_class punix_pvconn_class = {
m->wildcards = htonl(wc);
}
+/* Initializes 'vconn' as a new vconn named 'name', implemented via 'class'.
+ * The initial connection status, supplied as 'connect_status', is interpreted
+ * as follows:
+ *
+ * - 0: 'vconn' is connected. Its 'send' and 'recv' functions may be
+ * called in the normal fashion.
+ *
+ * - EAGAIN: 'vconn' is trying to complete a connection. Its 'connect'
+ * function should be called to complete the connection.
+ *
+ * - Other positive errno values indicate that the connection failed with
+ * the specified error.
+ *
+ * After calling this function, vconn_close() must be used to destroy 'vconn',
+ * otherwise resources will be leaked.
+ *
+ * The caller retains ownership of 'name'. */
void
vconn_init(struct vconn *vconn, struct vconn_class *class, int connect_status,
- const char *name, bool reconnectable)
+ const char *name)
{
vconn->class = class;
vconn->state = (connect_status == EAGAIN ? VCS_CONNECTING
vconn->local_ip = 0;
vconn->local_port = 0;
vconn->name = xstrdup(name);
- vconn->reconnectable = reconnectable;
}
void