refactor: Make httpserver work queue a unique_ptr #22361

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2106-httpRefactor changing 1 files +12 −14
  1. MarcoFalke commented at 9:51 AM on June 28, 2021: member

    This simplifies the code a bit because if (p) { delete p; p = nullptr; } can be replaced by a call to the reset() member.

  2. refactor: Make httpserver work queue a unique_ptr fa92e60f38
  3. fanquake added the label Refactoring on Jun 28, 2021
  4. promag commented at 9:54 AM on June 28, 2021: member

    Concept ACK.

    This simplifies the code a bit because if (p) { delete p; p = nullptr; } can be replaced by a call to the reset() member.

    Just delete p would be fine, but agree unique_ptr is better.

  5. practicalswift commented at 10:29 AM on June 28, 2021: contributor

    Concept ACK

    Nice to see another naked new get properly dressed :)

  6. promag commented at 1:02 PM on June 28, 2021: member

    Core review ACK fa92e60f38cb109fe5a3c7acfe1017ffebc388cc.

  7. jonatack commented at 1:35 PM on June 28, 2021: member

    ACK fa92e60f38cb109fe5a3c7acfe1017ffebc388cc code review, debug build clean, ran test/functional/interface*.py tests locally as a sanity check

  8. in src/httpserver.cpp:260 in fa92e60f38
     255 | @@ -256,10 +256,10 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
     256 |      // Dispatch to worker thread
     257 |      if (i != iend) {
     258 |          std::unique_ptr<HTTPWorkItem> item(new HTTPWorkItem(std::move(hreq), path, i->handler));
     259 | -        assert(workQueue);
     260 | -        if (workQueue->Enqueue(item.get()))
     261 | +        assert(g_work_queue);
     262 | +        if (g_work_queue->Enqueue(item.get())) {
    


    hebasto commented at 4:44 PM on June 28, 2021:
            if (Assert(g_work_queue)->Enqueue(item.get())) {
    
  9. hebasto approved
  10. hebasto commented at 4:44 PM on June 28, 2021: member

    ACK fa92e60f38cb109fe5a3c7acfe1017ffebc388cc, I have reviewed the code and it looks OK, I agree it can be merged.

  11. DrahtBot commented at 6:16 PM on June 28, 2021: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  12. MarcoFalke merged this on Jun 29, 2021
  13. MarcoFalke closed this on Jun 29, 2021

  14. MarcoFalke deleted the branch on Jun 29, 2021
  15. sidhujag referenced this in commit 2f11abdb7d on Jun 29, 2021
  16. PastaPastaPasta referenced this in commit 94ff316d34 on Sep 21, 2021
  17. PastaPastaPasta referenced this in commit 701c5db53c on Sep 24, 2021
  18. kittywhiskers referenced this in commit b59187c348 on Oct 12, 2021
  19. gwillen referenced this in commit f7a568bd1c on Jun 1, 2022
  20. DrahtBot locked this on Aug 18, 2022

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-17 06:14 UTC

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