Mercurial > pidgin.yaz
comparison libgaim/network.c @ 14776:a87c53e7b1e2
[gaim-migrate @ 17540]
Various fixes for wingaim network manager stuff.
When unable to look up network connections, assume that there is one.
Fix error handling.
Remove note about using WSANSPIoctl directly - it isn't supported on w2k anyway.
Fix compile warning
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 19 Oct 2006 01:56:40 +0000 |
parents | 51685370de57 |
children | 182f77347680 |
comparison
equal
deleted
inserted
replaced
14775:d1ffbae3a73a | 14776:a87c53e7b1e2 |
---|---|
390 qs.dwSize = sizeof(WSAQUERYSET); | 390 qs.dwSize = sizeof(WSAQUERYSET); |
391 qs.dwNameSpace = NS_ALL; | 391 qs.dwNameSpace = NS_ALL; |
392 | 392 |
393 retval = WSALookupServiceBegin(&qs, LUP_RETURN_ALL, &h); | 393 retval = WSALookupServiceBegin(&qs, LUP_RETURN_ALL, &h); |
394 if (retval != ERROR_SUCCESS) { | 394 if (retval != ERROR_SUCCESS) { |
395 gchar *msg = g_win32_error_message(retval); | 395 int errorid = WSAGetLastError(); |
396 gaim_debug_warning("network", "Couldn't look up connected networks. %s (%lu).\n", msg, retval); | 396 gchar *msg = g_win32_error_message(errorid); |
397 gaim_debug_warning("network", "Couldn't look up connected networks. %s (%d).\n", msg, errorid); | |
397 g_free(msg); | 398 g_free(msg); |
399 | |
400 net_cnt = 1; /* Assume something is connected */ | |
398 } else { | 401 } else { |
399 char buf[1024]; | 402 char buf[1024]; |
400 WSAQUERYSET *res = (LPWSAQUERYSET) buf; | 403 WSAQUERYSET *res = (LPWSAQUERYSET) buf; |
401 DWORD size = sizeof(buf); | 404 DWORD size = sizeof(buf); |
402 while (WSALookupServiceNext(h, 0, &size, res) == ERROR_SUCCESS) { | 405 while (WSALookupServiceNext(h, 0, &size, res) == ERROR_SUCCESS) { |
459 qs.dwNameSpace = NS_ALL; | 462 qs.dwNameSpace = NS_ALL; |
460 | 463 |
461 retval = WSALookupServiceBegin(&qs, LUP_RETURN_ALL, &h); | 464 retval = WSALookupServiceBegin(&qs, LUP_RETURN_ALL, &h); |
462 | 465 |
463 /* This will block until there is a network change */ | 466 /* This will block until there is a network change */ |
464 /* This is missing from the MinGW libws2_32.a as of version 3.7. | 467 retval = MyWSANSPIoctl(h, SIO_NSP_NOTIFY_CHANGE, NULL, 0, NULL, 0, &retLen, NULL); |
465 * When this patch: http://sourceforge.net/tracker/index.php?func=detail&aid=1576083&group_id=2435&atid=302435 gets into a release, we can call this directly | |
466 * retval = WSANSPIoctl(h, SIO_NSP_NOTIFY_CHANGE, NULL, 0, NULL, 0, &retLen, NULL);*/ | |
467 retval = MyWSANSPIoctl(h, SIO_NSP_NOTIFY_CHANGE, NULL, 0, NULL, 0, &retLen, NULL); | |
468 | 468 |
469 retval = WSALookupServiceEnd(h); | 469 retval = WSALookupServiceEnd(h); |
470 | 470 |
471 g_idle_add(wgaim_network_change_thread_cb, NULL); | 471 g_idle_add(wgaim_network_change_thread_cb, NULL); |
472 } | 472 } |
487 gaim_debug_warning("network", "NetworkManager not active or reports no connection (retval = %i)\n", libnm_retval); | 487 gaim_debug_warning("network", "NetworkManager not active or reports no connection (retval = %i)\n", libnm_retval); |
488 return FALSE; | 488 return FALSE; |
489 } | 489 } |
490 if (libnm_retval == LIBNM_ACTIVE_NETWORK_CONNECTION) return TRUE; | 490 if (libnm_retval == LIBNM_ACTIVE_NETWORK_CONNECTION) return TRUE; |
491 } | 491 } |
492 #elif _WIN32 | 492 #elif define _WIN32 |
493 return (current_network_count > 0); | 493 return (current_network_count > 0); |
494 #endif | 494 #endif |
495 return TRUE; | 495 return TRUE; |
496 } | 496 } |
497 | 497 |