diff options
author | kulikov <[email protected]> | 2023-08-24 21:02:28 +0300 |
---|---|---|
committer | kulikov <[email protected]> | 2023-08-24 21:21:32 +0300 |
commit | e952891ca11362042404965378d76b1b579aa424 (patch) | |
tree | b325f41be2e4caa6ff1c2802ad04a9a4dada2658 /library/cpp/http/server/http_ut.cpp | |
parent | 15c36956959084c1fefe469c2d9fda51f77fedb6 (diff) |
simplify, prepare for more than one listener thread
- move out listener and thread pools initialization stage from listener thread (no actual changes, this part of code was awaited via ListenStartEvent anyway) ;
- remove ListenerStartEvent and ListenerRunningOK flag, no use now;
- make Reqs list of listening sockets class member;
- leave Reqs list destruction in listener thread (it should happen just after Shutdown but after polling loop stopped to prevent races);
- ut for server startup fail.
Diffstat (limited to 'library/cpp/http/server/http_ut.cpp')
-rw-r--r-- | library/cpp/http/server/http_ut.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/library/cpp/http/server/http_ut.cpp b/library/cpp/http/server/http_ut.cpp index b953a4ef2ab..dc02c44295c 100644 --- a/library/cpp/http/server/http_ut.cpp +++ b/library/cpp/http/server/http_ut.cpp @@ -909,4 +909,29 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { } } } + + Y_UNIT_TEST(StartFail) { + TString res = TestData(); + TEchoServer serverImpl(res); + { + THttpServer server(&serverImpl, THttpServer::TOptions(1)); + + UNIT_ASSERT(!server.GetErrorCode()); + UNIT_ASSERT(!server.Start()); + UNIT_ASSERT(server.GetErrorCode()); + } + + { + TPortManager pm; + const ui16 port = pm.GetPort(); + THttpServer server1(&serverImpl, THttpServer::TOptions(port)); + UNIT_ASSERT(server1.Start()); + UNIT_ASSERT(!server1.GetErrorCode()); + + THttpServer server2(&serverImpl, THttpServer::TOptions(port)); + UNIT_ASSERT(!server2.Start()); + UNIT_ASSERT(server2.GetErrorCode()); + } + + } } |