Summary: | Support file transfer on windows. | ||
---|---|---|---|
Product: | Telepathy | Reporter: | Siraj Razick <siraj> |
Component: | salut | Assignee: | Siraj Razick <siraj> |
Status: | RESOLVED FIXED | QA Contact: | Telepathy bugs list <telepathy-bugs> |
Severity: | normal | ||
Priority: | medium | CC: | olli.salli |
Version: | unspecified | Keywords: | patch |
Hardware: | Other | ||
OS: | Windows (All) | ||
URL: | http://cgit.collabora.com/git/user/siraj/telepathy-salut.git/commit/?h=ft-windows&id=bf1c4181ffe5d134e8616e78d0ac27abb5a30e41 | ||
Whiteboard: | review+ | ||
i915 platform: | i915 features: |
Description
Siraj Razick
2012-03-22 11:09:17 UTC
initial patch :please note I didn't test it yet.. i'm doing it atm . Okay, some mistakes spotted > #ifdef G_OS_WIN32 > struct sockaddr_in addr; > #else > struct sockaddr_un addr; > #endif is followed by > new_fd = accept (g_io_channel_unix_get_fd (source), > (struct sockaddr *) &addr, &addrlen); This code is wrong on Unix too - it always uses a sockaddr_un to store the peer address, even when the socket is actually a IPv4 or a IPv6 socket. But it's also wrong on Windows - it might use the IPv4 address struct to store a IPv6 address, which'll surely lead to corrupted stack because IPv6 addresses are significantly longer. the addr variable is not actually read in the function after accept stores the address in it - and is not passed anywhere - so the easiest fix is to just remove the addr variable and pass NULL as the two latter arguments to accept(). Note that despite the name, g_io_channel_unix_get_fd is really the correct function to use even on Windows... From GLib docs: "On Windows this function returns the file descriptor or socket of the GIOChannel." However, this is not right: > #ifdef G_OS_WIN32 > channel = g_io_channel_win32_new_fd (new_fd); new_fd is a socket, so you must use g_io_channel_win32_new_socket so the correct IO implementation in GLib is used (it really has to be different for sockets and files on Windows :() Also, in get_socket_channel(): > fd = g_socket_get_fd (sock); > io_channel = g_io_channel_unix_new (fd); Here as well, instead of the unix_new() call we must use win32_new_socket() on windows. *** Bug 47272 has been marked as a duplicate of this bug. *** new patch with the changes working patch, along with contact-manager/contact patch OK - can be merged after the bug 47429 branch which this is based on is merged, provided you test file transfer again to verify the fixes for it are implemented correctly. Merged, will be in 0.7.2. Thanks! |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.