Skip to content

Commit

Permalink
fix close command server bug
Browse files Browse the repository at this point in the history
  • Loading branch information
simaosanguinho committed Dec 17, 2023
1 parent eff2a93 commit 742f42d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CXXFLAGS += $(INCLUDES)
LDFLAGS += $(INCLUDES)


LDFLAGS = -fsanitize=address -lasan
#LDFLAGS = -fsanitize=address -lasan

CXXFLAGS += -fdiagnostics-color=always
CXXFLAGS += -Wall
Expand Down
Binary file added src/server/server
Binary file not shown.
7 changes: 6 additions & 1 deletion src/server/server_auction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ void AuctionManager::closeAuction(std::string userID, std::string password,
// check if auction has already expired
if (checkAuctionValidity(auctionID) == INVALID) {
createCloseAuctionFile(auctionID, false);
throw NonActiveAuctionException();
} else {
createCloseAuctionFile(auctionID, true);
}
Expand Down Expand Up @@ -533,7 +534,11 @@ AuctionManager::getAuctionRecord(std::string auctionID) {
}

if (checkAuctionValidity(auctionID) == INVALID) { // check auction validity
createCloseAuctionFile(auctionID, false);
try {
createCloseAuctionFile(auctionID, false);
} catch (NonActiveAuctionException &e) {
// if auction was closed, ignore it
}
}

std::string auctionInfo = getAuctionInfo(auctionID);
Expand Down

0 comments on commit 742f42d

Please sign in to comment.