device: fix crash by handling connection cancellation

16 jobs for afaure/protect-self-variable in 41 minutes and 48 seconds (queued for 3 seconds)
latest
Status Job ID Name Coverage
  Test
passed #789112
allowed to fail
checkpatch

00:01:54

manual #789118
allowed to fail manual
t_centos:7.5.1804
passed #789119
t_centos:7.6.1810

00:20:38

passed #789125
t_debian:10

00:11:15

passed #789124
t_debian:9

00:21:14

passed #789127
t_debian:sid

00:21:05

manual #789126
allowed to fail manual
t_debian:testing
manual #789113
allowed to fail manual
t_fedora:28
passed #789114
t_fedora:29

00:41:45

passed #789115
t_fedora:30

00:28:41

passed #789116
t_fedora:31

00:34:53

manual #789117
allowed to fail manual
t_fedora:rawhide
passed #789120
t_ubuntu:16.04

00:27:11

passed #789121
t_ubuntu:18.04

00:17:25

manual #789123
allowed to fail manual
t_ubuntu:devel
manual #789122
allowed to fail manual
t_ubuntu:rolling