Skip to content

Commit

Permalink
char-socket: add 'connected' property
Browse files Browse the repository at this point in the history
Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
  • Loading branch information
elmarco committed May 4, 2017
1 parent 123676e commit da2d19b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions chardev/char-socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,14 @@ char_socket_get_addr(Object *obj, Visitor *v, const char *name,
visit_type_SocketAddress(v, name, &s->addr, errp);
}

static bool
char_socket_get_connected(Object *obj, Error **errp)
{
SocketChardev *s = SOCKET_CHARDEV(obj);

return s->connected;
}

static void char_socket_class_init(ObjectClass *oc, void *data)
{
ChardevClass *cc = CHARDEV_CLASS(oc);
Expand All @@ -1037,6 +1045,9 @@ static void char_socket_class_init(ObjectClass *oc, void *data)
object_class_property_add(oc, "addr", "SocketAddress",
char_socket_get_addr, NULL,
NULL, NULL, &error_abort);

object_class_property_add_bool(oc, "connected", char_socket_get_connected,
NULL, &error_abort);
}

static const TypeInfo char_socket_type_info = {
Expand Down

0 comments on commit da2d19b

Please sign in to comment.