The evhttp_connection_get_peer in the libevent has now const char** #23606

issue Perlover opened this issue on November 26, 2021
  1. Perlover commented at 4:18 PM on November 26, 2021: contributor

    <!-- This issue tracker is only for technical issues related to Bitcoin Core. General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange at https://bitcoin.stackexchange.com. For reporting security issues, please read instructions at https://bitcoincore.org/en/contact/. If the node is "stuck" during sync or giving "block checksum mismatch" errors, please ensure your hardware is stable by running memtest and observe CPU temperature with a load-test tool such as linpack before creating an issue! -->

    The developers of the libevent library changed the parameter type, which now conflicts with your parameter conversion.

    <!-- Describe the issue -->

    Expected behavior

    A compilation without errors

    <!--- What behavior did you expect? -->

    Actual behavior

    <!--- What was the actual behavior (provide screenshots if the issue is GUI-related)? -->

    A compilation from sources (the current master branch today) shows to me a following errors:

      CXX      libbitcoin_server_a-httpserver.o
    httpserver.cpp: In member function 'CService HTTPRequest::GetPeer() const':
    httpserver.cpp:600:41: error: invalid conversion from 'char**' to 'const char**' [-fpermissive]
      600 |         evhttp_connection_get_peer(con, (char**)&address, &port);
          |                                         ^~~~~~~~~~~~~~~~
          |                                         |
          |                                         char**
    In file included from ./support/events.h:12,
                     from httpserver.cpp:35:
    /home/bitcoin/include/event2/http.h:981:18: note:   initializing argument 2 of 'void evhttp_connection_get_peer(evhttp_connection*, const char**, uint16_t*)'
      981 |     const char **address, ev_uint16_t *port);
          |     ~~~~~~~~~~~~~^~~~~~~
    

    I researched the problem and found that the libevent which I use (from sources) has the related commit:

    commit a18301a2bb160ff7c3ffaf5b7653c39ffe27b385
    Author: Leon M. George <leon@georgemail.eu>
    Date:   Tue Sep 8 15:38:16 2020 +0200
    
        http: const out address param to evcon_get_peer
    
    diff --git a/http.c b/http.c
    index abd255dc..8afb3600 100644
    --- a/http.c
    +++ b/http.c
    @@ -2754,7 +2754,7 @@ evhttp_connection_set_closecb(struct evhttp_connection *evcon,
     
     void
     evhttp_connection_get_peer(struct evhttp_connection *evcon,
    -    char **address, ev_uint16_t *port)
    +    const char **address, ev_uint16_t *port)
    

    To reproduce

    <!--- How reliably can you reproduce the issue, what are the steps to do so? -->

    May be you have to have a following software:

    • gcc v11.2.0
    • libevent with commit a18301a2bb160ff7c3ffaf5b7653c39ffe27b385 (Tue Sep 8 15:38:16 2020 +0200)
    • bitcoind current master branch (at 2021-11-26)

    System information

    <!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->

    <!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->

    <!-- GUI-related issue? What is your operating system and its version? If Linux, what is your desktop environment and graphical shell? -->

    <!-- Any extra information that might be useful in the debugging process. -->

    <!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->

  2. Perlover added the label Bug on Nov 26, 2021
  3. Perlover referenced this in commit d5b9f70958 on Nov 26, 2021
  4. fanquake deleted a comment on Nov 28, 2021
  5. laanwj referenced this in commit 767ee2e3a1 on Jan 13, 2022
  6. sidhujag referenced this in commit b8dfbdb946 on Jan 14, 2022
  7. Perlover closed this on May 14, 2022

  8. DrahtBot locked this on May 14, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-29 03:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me