X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fvconn-stream.c;h=b38c568686362b90d18bcf343b299d0c039be0dc;hb=6b9bd979007f5c9641ebec745cfed26b7fab645e;hp=46279e57ea03ab0a5bf79075e2e1f8235f9cf02f;hpb=193456d581423f894e57e8463ff5049c0d802f0a;p=openvswitch diff --git a/lib/vconn-stream.c b/lib/vconn-stream.c index 46279e57..b38c5686 100644 --- a/lib/vconn-stream.c +++ b/lib/vconn-stream.c @@ -41,7 +41,6 @@ struct stream_vconn { struct vconn vconn; int fd; - void (*connect_success_cb)(struct vconn *, int); struct ofpbuf *rxbuf; struct ofpbuf *txbuf; struct poll_waiter *tx_waiter; @@ -55,21 +54,17 @@ static void stream_clear_txbuf(struct stream_vconn *); int new_stream_vconn(const char *name, int fd, int connect_status, - uint32_t remote_ip, uint16_t remote_port, - bool reconnectable, - connect_success_cb_func *connect_success_cb, - struct vconn **vconnp) + bool reconnectable, struct vconn **vconnp) { struct stream_vconn *s; s = xmalloc(sizeof *s); - vconn_init(&s->vconn, &stream_vconn_class, connect_status, remote_ip, - remote_port, name, reconnectable); + vconn_init(&s->vconn, &stream_vconn_class, connect_status, + name, reconnectable); s->fd = fd; s->txbuf = NULL; s->tx_waiter = NULL; s->rxbuf = NULL; - s->connect_success_cb = connect_success_cb; *vconnp = &s->vconn; return 0; } @@ -96,14 +91,7 @@ static int stream_connect(struct vconn *vconn) { struct stream_vconn *s = stream_vconn_cast(vconn); - int retval = check_connection_completion(s->fd); - if (retval) { - return retval; - } - if (s->connect_success_cb) { - s->connect_success_cb(vconn, s->fd); - } - return 0; + return check_connection_completion(s->fd); } static int @@ -282,23 +270,7 @@ new_pstream_pvconn(const char *name, int fd, size_t sa_len, struct vconn **), struct pvconn **pvconnp) { - struct pstream_pvconn *ps; - int retval; - - retval = set_nonblocking(fd); - if (retval) { - close(fd); - return retval; - } - - if (listen(fd, 10) < 0) { - int error = errno; - VLOG_ERR("%s: listen: %s", name, strerror(error)); - close(fd); - return error; - } - - ps = xmalloc(sizeof *ps); + struct pstream_pvconn *ps = xmalloc(sizeof *ps); pvconn_init(&ps->pvconn, &pstream_pvconn_class, name); ps->fd = fd; ps->accept_cb = accept_cb;