aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-12-21 15:43:46 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2017-05-04 15:34:41 +0400
commitda2d19b080f6214b646a9f250760f5f41adcd21b (patch)
tree20bb6c6fad1bd4849b0e2e2091d74fd6151e3e8f
parent123676e9894fa221943eafda97e6954c2819b215 (diff)
char-socket: add 'connected' property
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
-rw-r--r--chardev/char-socket.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 5a5840edb1..0118252002 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -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);
@@ -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 = {