rpc: Fix client crash on connection close
rpc: Fix client crash on connection close

A multi-threaded client with event loop may crash if one of its threads
closes a connection while event loop is in the middle of sending
keep-alive message (either request or response). The right place for it
is inside virNetClientIOEventLoop() between poll() and
virNetClientLock(). We should only close a connection directly if no-one
is using it and defer the closing to the last user otherwise. So far we
only did so if the close was initiated by keep-alive timeout.

trainstack/libvirt,iam-TJ/libvirt,fabianfreyer/libvirt,fabianfreyer/libvirt,dumbbell/libvirt,trainstack/libvirt,jfehlig/libvirt,siboulet/libvirt-openvz,shugaoye/libvirt,jfehlig/libvirt,dumbbell/libvirt,agx/libvirt,wiedi/libvirt,eskultety/libvirt,zhlcindy/libvirt-1.1.4-maintain,trainstack/libvirt,warewolf/libvirt,olafhering/libvirt,jfehlig/libvirt,warewolf/libvirt,agx/libvirt,shugaoye/libvirt,shugaoye/libvirt,foomango/libvirt,siboulet/libvirt-openvz,rlaager/libvirt,andreabolognani/libvirt,nertpinx/libvirt,taget/libvirt,jardasgit/libvirt,shugaoye/libvirt,jeckersb/libvirt,dumbbell/libvirt,warewolf/libvirt,rlaager/libvirt,novel/fbsd-libvirt,warewolf/libvirt,zhlcindy/libvirt-1.1.4-maintain,fabianfreyer/libvirt,eskultety/libvirt,eskultety/libvirt,wiedi/libvirt,emaste/libvirt,taget/libvirt,taget/libvirt,crobinso/libvirt,foomango/libvirt,nertpinx/libvirt,warewolf/libvirt,olafhering/libvirt,trainstack/libvirt,foomango/libvirt,andreabolognani/libvirt,olafhering/libvirt,jeckersb/libvirt,zhlcindy/libvirt-1.1.4-maintain,trainstack/libvirt,elmarco/libvirt,dumbbell/libvirt,agx/libvirt,iam-TJ/libvirt,nertpinx/libvirt,datto/libvirt,rmarwaha/libvirt,emaste/libvirt,warewolf/libvirt,novel/fbsd-libvirt,zippy2/libvirt,crobinso/libvirt,trainstack/libvirt,jeckersb/libvirt,nertpinx/libvirt,cbosdo/libvirt,libvirt/libvirt,zippy2/libvirt,jardasgit/libvirt,dumbbell/libvirt,rmarwaha/libvirt1,taget/libvirt,emaste/libvirt,rmarwaha/libvirt1,emaste/libvirt,crobinso/libvirt,jfehlig/libvirt,novel/fbsd-libvirt,cbosdo/libvirt,VenkatDatta/libvirt,siboulet/libvirt-openvz,VenkatDatta/libvirt,datto/libvirt,emaste/libvirt,iam-TJ/libvirt,libvirt/libvirt,crobinso/libvirt,jeckersb/libvirt,andreabolognani/libvirt,fabianfreyer/libvirt,rmarwaha/libvirt1,foomango/libvirt,warewolf/libvirt,taget/libvirt,jeckersb/libvirt,novel/fbsd-libvirt,iam-TJ/libvirt,rmarwaha/libvirt,rmarwaha/libvirt,wiedi/libvirt,nertpinx/libvirt,rlaager/libvirt,jardasgit/libvirt,zippy2/libvirt,rmarwaha/libvirt,jardasgit/libvirt,wiedi/libvirt,novel/fbsd-libvirt,shugaoye/libvirt,libvirt/libvirt,andreabolognani/libvirt,jardasgit/libvirt,eskultety/libvirt,VenkatDatta/libvirt,datto/libvirt,zhlcindy/libvirt-1.1.4-maintain,rlaager/libvirt,rmarwaha/libvirt1,VenkatDatta/libvirt,siboulet/libvirt-openvz,iam-TJ/libvirt,rmarwaha/libvirt1,iam-TJ/libvirt,fabianfreyer/libvirt,cbosdo/libvirt,rmarwaha/libvirt1,dumbbell/libvirt,libvirt/libvirt,novel/fbsd-libvirt,wiedi/libvirt,elmarco/libvirt,novel/fbsd-libvirt,elmarco/libvirt,VenkatDatta/libvirt,jeckersb/libvirt,eskultety/libvirt,trainstack/libvirt,andreabolognani/libvirt,datto/libvirt,olafhering/libvirt,rmarwaha/libvirt,foomango/libvirt,elmarco/libvirt,elmarco/libvirt,bjzhang/libvirt,emaste/libvirt,cbosdo/libvirt,rlaager/libvirt,agx/libvirt,datto/libvirt,bjzhang/libvirt,bjzhang/libvirt,iam-TJ/libvirt,wiedi/libvirt,zhlcindy/libvirt-1.1.4-maintain,jeckersb/libvirt,rmarwaha/libvirt,siboulet/libvirt-openvz,cbosdo/libvirt,novel/fbsd-libvirt,emaste/libvirt,zippy2/libvirt,bjzhang/libvirt,wiedi/libvirt,novel/fbsd-libvirt,bjzhang/libvirt,agx/libvirt