From 85ab0a021523e51435539af0e6a138c73c9846a2 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 21 Sep 2009 12:33:30 -0700 Subject: [PATCH] vconn: Remove unused "reconnectable" member from vconn. This member is initialized, but nothing ever reads it, so get rid of it. --- lib/vconn-provider.h | 3 +-- lib/vconn-ssl.c | 2 +- lib/vconn-stream.c | 5 ++--- lib/vconn-stream.h | 2 +- lib/vconn-tcp.c | 2 +- lib/vconn-unix.c | 4 ++-- lib/vconn.c | 20 ++++++++++++++++++-- 7 files changed, 26 insertions(+), 12 deletions(-) diff --git a/lib/vconn-provider.h b/lib/vconn-provider.h index ae025f7c..f245e4c1 100644 --- a/lib/vconn-provider.h +++ b/lib/vconn-provider.h @@ -39,11 +39,10 @@ struct vconn { 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); diff --git a/lib/vconn-ssl.c b/lib/vconn-ssl.c index 9bb2df8a..2452bcea 100644 --- a/lib/vconn-ssl.c +++ b/lib/vconn-ssl.c @@ -246,7 +246,7 @@ new_ssl_vconn(const char *name, int fd, enum session_type type, /* 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); diff --git a/lib/vconn-stream.c b/lib/vconn-stream.c index b38c5686..e2991ddf 100644 --- a/lib/vconn-stream.c +++ b/lib/vconn-stream.c @@ -54,13 +54,12 @@ static void stream_clear_txbuf(struct stream_vconn *); 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; diff --git a/lib/vconn-stream.h b/lib/vconn-stream.h index 0adac9ad..fd3d8bd4 100644 --- a/lib/vconn-stream.h +++ b/lib/vconn-stream.h @@ -26,7 +26,7 @@ struct pvconn; 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 **), diff --git a/lib/vconn-tcp.c b/lib/vconn-tcp.c index 998a2001..44f49f10 100644 --- a/lib/vconn-tcp.c +++ b/lib/vconn-tcp.c @@ -58,7 +58,7 @@ new_tcp_vconn(const char *name, int fd, int connect_status, 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); diff --git a/lib/vconn-unix.c b/lib/vconn-unix.c index 93d14e83..e2b6f7a3 100644 --- a/lib/vconn-unix.c +++ b/lib/vconn-unix.c @@ -60,7 +60,7 @@ unix_open(const char *name, char *suffix, struct vconn **vconnp) } return new_stream_vconn(name, fd, check_connection_completion(fd), - true, vconnp); + vconnp); } struct vconn_class unix_vconn_class = { @@ -118,7 +118,7 @@ punix_accept(int fd, const struct sockaddr *sa, size_t sa_len, } 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 = { diff --git a/lib/vconn.c b/lib/vconn.c index aed1880d..66a56bcd 100644 --- a/lib/vconn.c +++ b/lib/vconn.c @@ -1388,9 +1388,26 @@ normalize_match(struct ofp_match *m) 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 @@ -1404,7 +1421,6 @@ vconn_init(struct vconn *vconn, struct vconn_class *class, int connect_status, vconn->local_ip = 0; vconn->local_port = 0; vconn->name = xstrdup(name); - vconn->reconnectable = reconnectable; } void -- 2.30.2