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 1207d5a..f13e346 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;
 }