2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-15 14:17:18 +00:00

Check invariants earlier in vconn and stream code.

These invariants are checked by vconn_open() and stream_open(), but there
is no reason not to check them earlier also.  vconn and stream creation
don't have to go through vconn_open() and stream_open(), so this ensures
that the invariants get checked either way.
This commit is contained in:
Ben Pfaff
2010-01-06 14:20:19 -08:00
parent 84ee7bcfde
commit e0668bd1d4
2 changed files with 2 additions and 0 deletions

View File

@@ -476,6 +476,7 @@ stream_init(struct stream *stream, struct stream_class *class,
: SCS_DISCONNECTED); : SCS_DISCONNECTED);
stream->error = connect_status; stream->error = connect_status;
stream->name = xstrdup(name); stream->name = xstrdup(name);
assert(stream->state != SCS_CONNECTING || class->connect);
} }
void void

View File

@@ -1444,6 +1444,7 @@ vconn_init(struct vconn *vconn, struct vconn_class *class, int connect_status,
vconn->local_ip = 0; vconn->local_ip = 0;
vconn->local_port = 0; vconn->local_port = 0;
vconn->name = xstrdup(name); vconn->name = xstrdup(name);
assert(vconn->state != VCS_CONNECTING || class->connect);
} }
void void