chiark / gitweb /
bus: properly handle if we get disconnected during HELLO phase
authorLennart Poettering <lennart@poettering.net>
Wed, 27 Nov 2013 19:24:10 +0000 (20:24 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 27 Nov 2013 19:28:48 +0000 (20:28 +0100)
src/libsystemd-bus/sd-bus.c

index 1207d5ad2e1ea8394a2a9a7b7e4d753231bf5c0b..f13e346dcfb105f0830e60e957b94e838b467bde 100644 (file)
@@ -380,7 +380,7 @@ static int hello_callback(sd_bus *bus, sd_bus_message *reply, void *userdata, sd
         int r;
 
         assert(bus);
-        assert(bus->state == BUS_HELLO);
+        assert(bus->state == BUS_HELLO || bus->state == BUS_CLOSING);
         assert(reply);
 
         r = sd_bus_message_get_errno(reply);
@@ -400,7 +400,8 @@ static int hello_callback(sd_bus *bus, sd_bus_message *reply, void *userdata, sd
         if (!bus->unique_name)
                 return -ENOMEM;
 
-        bus->state = BUS_RUNNING;
+        if (bus->state == BUS_HELLO)
+                bus->state = BUS_RUNNING;
 
         return 1;
 }