MCPcopy Create free account
hub / github.com/boostorg/beast / testIoService

Method testIoService

test/beast/http/write.cpp:638–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636 };
637
638 void
639 testIoService()
640 {
641 {
642 // Make sure handlers are not destroyed
643 // after calling io_context::stop
644 net::io_context ioc;
645 test::stream ts{ioc};
646 BEAST_EXPECT(handler::count() == 0);
647 request<string_body> m;
648 m.method(verb::get);
649 m.version(11);
650 m.target("/");
651 m.set("Content-Length", "5");
652 m.body() = "*****";
653 async_write(ts, m, handler{});
654 BEAST_EXPECT(handler::count() > 0);
655 ioc.stop();
656 BEAST_EXPECT(handler::count() > 0);
657 ioc.restart();
658 BEAST_EXPECT(handler::count() > 0);
659 ioc.run_one();
660 BEAST_EXPECT(handler::count() == 0);
661 }
662 {
663 // Make sure uninvoked handlers are
664 // destroyed when calling ~io_context
665 {
666 net::io_context ioc;
667 test::stream ts{ioc}, tr{ioc};
668 ts.connect(tr);
669 BEAST_EXPECT(handler::count() == 0);
670 request<string_body> m;
671 m.method(verb::get);
672 m.version(11);
673 m.target("/");
674 m.set("Content-Length", "5");
675 m.body() = "*****";
676 async_write(ts, m, handler{});
677 BEAST_EXPECT(handler::count() > 0);
678 }
679 BEAST_EXPECT(handler::count() == 0);
680 }
681 }
682
683 template<
684 class Stream,

Callers

nothing calls this directly

Calls 5

methodMethod · 0.80
targetMethod · 0.80
bodyMethod · 0.80
async_writeFunction · 0.50
versionMethod · 0.45

Tested by

no test coverage detected