H On Thu, Mar 24, 2016 at 10:34 AM, Victor Toso <li...@victortoso.com> wrote:
> Hi, > > On Thu, Mar 17, 2016 at 02:47:51PM +0100, Lukas Venhoda wrote: > > When stopping the service, automatically disconnect shared folder on > > windows. Not dismounting could lead to multiple shared folders. > > But when user disconnect, the service is not stopped, correct? I think > we need some integration with spice-vdagent to be aware of when the > client disconnect in order to umount the shared folder. > > That could be in a different bug but please file it upstream and > include this bits of information there. > > Yes. This is not possible with the current implementation, and will require VDAgent integration. Will provide the neccessary information, and file a bug. > > static void > > +unmap_drive(void) > > +{ > > + gchar local_name[3]; > > + guint32 retval; > > + > > + local_name[0] = drive_letter; > > + local_name[1] = ':'; > > + local_name[2] = 0; > > + > > + retval = WNetCancelConnection2(local_name, CONNECT_UPDATE_PROFILE, > TRUE); > > + > > + if (retval == NO_ERROR) > > + g_debug ("unmap_drive ok"); > > + else if (retval == ERROR_NOT_CONNECTED) > > + g_debug ("drive not connected"); > > Nothing should be done if we map the drive before but fail to unmap with > ERROR_NOT_CONNECTED ? > We don't need to. This just tries to unmap the drive. If the drive is already unmapped (not connected), then there's nothing to do. > > > + else > > + g_critical ("map_drive error %d", retval); > > Also, in multiple if/else if please use braces. > ok > > @@ -969,6 +991,7 @@ service_ctrl_handler (DWORD ctrl, DWORD type, LPVOID > data, LPVOID ctx) > > { > > case SERVICE_CONTROL_STOP: > > case SERVICE_CONTROL_SHUTDOWN: > > + unmap_drive (); > > As Pavel said, it does not seem you need drive_letter as global. You can > have it as userdata in the GTask and as argument for unmap_drive () > changed since map and unmap are in different functions, user_data would not work I changed he is_spice_folder_mapped function to return the letter, and now I can unmap the drive correctly without the need of global variable. -- Lukas Venhoda
_______________________________________________ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel