[PATCH] wininet: Close sockets open in http requests

Nigel Liang ncliang at gmail.com
Wed Oct 17 16:05:35 CDT 2007


On 10/13/07, Nigel Liang <ncliang at gmail.com> wrote:
> Hi,
>
> Http requests open sockets and forget to close them. Left running over a long
> period, the socket file descriptor starts getting large. Once it exceeds
> FD_SETSIZE, the behavior becomes unpredictable and results in funcky crashes.
>
> -Nigel
>
> ---
>  dlls/wininet/internet.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
> index 0edca74..8e3a98e 100644
> --- a/dlls/wininet/internet.c
> +++ b/dlls/wininet/internet.c
> @@ -1014,6 +1014,9 @@ BOOL WINAPI InternetCloseHandle(HINTERNE
>          return FALSE;
>      }
>
> +    if (lpwh->htype == WH_HHTTPREQ)
> +        NETCON_close(&((LPWININETHTTPREQW)lpwh)->netConnection);
> +
>      WININET_Release( lpwh );
>      WININET_FreeHandle( hInternet );
>
> --
> 1.4.1
>
>

Hi,

This patch was sent 4 days ago and it hasn't gone in yet. Could anyone
give me some comments on it? Dan filed bug 10032 which is related to
this. While we shouldn't be using select() on high FDs for networking,
this patch closes the sockets that were open by http requests to avoid
getting to high FDs...

Thanks,
-Nigel



More information about the wine-devel mailing list