fatal_signal_run();
- while (error == EAGAIN) {
- stream_run(stream);
- stream_run_wait(stream);
- stream_connect_wait(stream);
- poll_block();
- error = stream_connect(stream);
+ if (!error) {
+ while ((error = stream_connect(stream)) == EAGAIN) {
+ stream_run(stream);
+ stream_run_wait(stream);
+ stream_connect_wait(stream);
+ poll_block();
+ }
assert(error != EINPROGRESS);
}
+
if (error) {
stream_close(stream);
*streamp = NULL;
error = stream_open_with_default_ports(name, OFP_TCP_PORT, OFP_SSL_PORT,
&stream);
-
- if (error && error != EAGAIN) {
- return error;
+ if (!error) {
+ error = stream_connect(stream);
+ if (!error || error == EAGAIN) {
+ *vconnp = vconn_stream_new(stream, error);
+ return 0;
+ }
}
- *vconnp = vconn_stream_new(stream, error);
- return 0;
+ stream_close(stream);
+ return error;
}
static struct vconn_stream *
fatal_signal_run();
error = vconn_open(name, min_version, &vconn);
- while (error == EAGAIN) {
- vconn_run(vconn);
- vconn_run_wait(vconn);
- vconn_connect_wait(vconn);
- poll_block();
- error = vconn_connect(vconn);
+ if (!error) {
+ while ((error == vconn_connect(vconn)) == EAGAIN) {
+ vconn_run(vconn);
+ vconn_run_wait(vconn);
+ vconn_connect_wait(vconn);
+ poll_block();
+ }
assert(error != EINPROGRESS);
}
+
if (error) {
vconn_close(vconn);
*vconnp = NULL;
struct fake_pvconn fpv;
struct vconn *vconn;
- expected_error = !strcmp(type, "unix") ? EPIPE : ECONNRESET;
+ expected_error = (!strcmp(type, "unix") ? EPIPE
+ : !strcmp(type, "tcp") ? ECONNRESET
+ : EPROTO);
fpv_create(type, &fpv);
CHECK_ERRNO(vconn_open(fpv.vconn_name, OFP_VERSION, &vconn), 0);