Skip to content

Commit

Permalink
bug(server): exit not crash when port in use (#516)
Browse files Browse the repository at this point in the history
Signed-off-by: adi_holden <adi@dragonflydb.io>
  • Loading branch information
adiholden authored Nov 29, 2022
1 parent 2493434 commit f57bf0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/server/dfly_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ bool RunEngine(ProactorPool* pool, AcceptServer* acceptor) {

error_code ec = acceptor->AddListener(bind_addr, port, main_listener);

LOG_IF(FATAL, ec) << "Could not open port " << port << ", error: " << ec.message();
if (ec) {
LOG(ERROR) << "Could not open port " << port << ", error: " << ec.message();
exit(1);
}

if (mc_port > 0) {
acceptor->AddListener(mc_port, new Listener{Protocol::MEMCACHE, &service});
Expand Down

0 comments on commit f57bf0d

Please sign in to comment.