void
vconn_run(struct vconn *vconn)
{
+ if (vconn->state == VCS_CONNECTING ||
+ vconn->state == VCS_SEND_HELLO ||
+ vconn->state == VCS_RECV_HELLO) {
+ vconn_connect(vconn);
+ }
+
if (vconn->class->run) {
(vconn->class->run)(vconn);
}
void
vconn_run_wait(struct vconn *vconn)
{
+ if (vconn->state == VCS_CONNECTING ||
+ vconn->state == VCS_SEND_HELLO ||
+ vconn->state == VCS_RECV_HELLO) {
+ vconn_connect_wait(vconn);
+ }
+
if (vconn->class->run_wait) {
(vconn->class->run_wait)(vconn);
}
test_accept_then_close(int argc OVS_UNUSED, char *argv[])
{
const char *type = argv[1];
- int expected_error;
struct fake_pvconn fpv;
struct vconn *vconn;
-
- expected_error = (!strcmp(type, "unix") ? EPIPE
- : !strcmp(type, "tcp") ? ECONNRESET
- : EPROTO);
+ int error;
fpv_create(type, &fpv);
CHECK_ERRNO(vconn_open(fpv.vconn_name, OFP10_VERSION, &vconn,
vconn_run(vconn);
stream_close(fpv_accept(&fpv));
fpv_close(&fpv);
- CHECK_ERRNO(vconn_connect(vconn), expected_error);
+
+ error = vconn_connect_block(vconn);
+ if (!strcmp(type, "tcp") || !strcmp(type, "unix")) {
+ if (error != ECONNRESET && error != EPIPE) {
+ ovs_fatal(0, "unexpected vconn_connect() return value %d (%s)",
+ error, strerror(error));
+ }
+ } else {
+ CHECK_ERRNO(error, EPROTO);
+ }
+
vconn_close(vconn);
fpv_destroy(&fpv);
}