libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] External logging


From: Christian Grothoff
Subject: Re: [libmicrohttpd] External logging
Date: Thu, 29 Nov 2018 11:25:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0

There is one tiny bug. You are dereferencing 'arg', but never passed its
address. So use:

  MHD_OPTION_EXTERNAL_LOGGER,
  MHD_external_logger, (void*) &MHD_logger,

and it should work.

On 11/29/18 9:25 AM, address@hidden wrote:
> Hi MHD team/Christian,
> 
>  
> 
> I implemented MHD in a windows application via MSYS. To detect some
> intermittent connection-break issues, I implemented external logging. It
> looks straightforward and that is why I doubt if it is the right way to
> do, too… messages are enabled (not compiled with –disable-messages) and
> I also use MHD_USE_DEBUG.
> 
>  
> 
> FILE* MHD_logger = NULL; //somewhere in the code
> 
>  
> 
> voidMHD_external_logger(void* arg, constchar* fmt, va_listap)
> 
> {
> 
>       
> 
>        if(arg!= NULL)
> 
>        {
> 
>               FILE* _fptr = *((FILE**)(arg));
> 
>               vfprintf_s(_fptr, fmt, ap);
> 
>        }
> 
> }
> 
>  
> 
> //…
> 
> //
> 
> m_pMhd = MHD_start_daemon(flags | MHD_USE_DEBUG, gblusport,
> 
>                              //NULL,NULL,
> 
>                              AcceptPolicyCallback, this,
> 
>                              AccessHandlerCallback, this,
> 
>                              MHD_OPTION_CONNECTION_TIMEOUT,
> (unsignedint)120,
> 
>                              MHD_OPTION_SOCK_ADDR, &addr,
> 
>                              MHD_OPTION_HTTPS_MEM_KEY, key_file_pem.c_str(),
> 
>                              MHD_OPTION_HTTPS_MEM_CERT,
> cert_file_pem.c_str(),
> 
>                              MHD_OPTION_EXTERNAL_LOGGER,
> MHD_external_logger, (void*)MHD_logger,
> 
>                              MHD_OPTION_ARRAY, &ops[0],
> 
>                              MHD_OPTION_END);
> 
>  
> 
>  
> 
> -Sreejith.
> 
>  
> 

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]