[ovs-dev] [PATCH 8/9] vconn: Reimplement in terms of the "stream" abstraction.
Justin Pettit
jpettit at nicira.com
Wed Jan 6 21:57:22 UTC 2010
On Dec 21, 2009, at 1:15 PM, Ben Pfaff wrote:
>
> +
> +/* Creates a new vconn that will send and receive data on a stream named 'name'
> + * and stores a pointer to the vconn in '*vconnp'.
> + *
> + * Returns 0 if successful, otherwise a positive errno value. (The current
> + * implementation never fails.) */
Is this true? It seems like stream_open can fail, which will return an error.
> +static int
> +vconn_stream_open(const char *name_, char *suffix UNUSED,
> + struct vconn **vconnp)
> +{
> + struct stream *stream;
> + char *name;
> + int error;
> +
> + if (!strncmp(name_, "tcp:", 4) && count_fields(name_) < 3) {
> + name = xasprintf("%s:%d", name_, OFP_TCP_PORT);
> + } else if (!strncmp(name_, "ssl:", 4) && count_fields(name_) < 3) {
> + name = xasprintf("%s:%d", name_, OFP_SSL_PORT);
> + } else {
> + name = xstrdup(name_);
> + }
> + error = stream_open(name, &stream);
> + free(name);
> +
> + if (error && error != EAGAIN) {
> + return error;
> + }
> +
> + *vconnp = vconn_stream_new(stream, error);
> return 0;
> }
Otherwise, from my quick read-through, it seemed reasonable.
--Justin
More information about the dev
mailing list