From 888b6ab03fd28d3d063569d1b77baf131e361eea Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 2 Sep 2013 20:25:29 +0200 Subject: [PATCH] Disable the cancellation callback during shutdown. Several backends require a shutdown command to be send before closing the connection. If such a command gets cancelled, that might result in an unclean shutdown. Backends where this is problematic can always ignore cancellation requests internally, but it's less error-prone (and much easier) to simply disable the cancellation callback for all backends, before closing the connection. --- src/device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/device.c b/src/device.c index 0fa4e7e..2aa6289 100644 --- a/src/device.c +++ b/src/device.c @@ -315,6 +315,10 @@ dc_device_close (dc_device_t *device) if (device->vtable->close == NULL) return DC_STATUS_UNSUPPORTED; + // Disable the cancellation callback. + device->cancel_callback = NULL; + device->cancel_userdata = NULL; + return device->vtable->close (device); }