Dmitry Beresnev commited on
Commit
dc32982
·
1 Parent(s): 470e737

fix exceptions

Browse files
Files changed (1) hide show
  1. cpp/server.cpp +5 -0
cpp/server.cpp CHANGED
@@ -583,6 +583,11 @@ void do_session(
583
  http::write(socket, res);
584
  beast::error_code ec;
585
  socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
 
 
 
 
 
586
  } catch (const std::exception &e) {
587
  log_line("session_exception=" + std::string(e.what()));
588
  } catch (...) {
 
583
  http::write(socket, res);
584
  beast::error_code ec;
585
  socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
586
+ } catch (const beast::system_error &e) {
587
+ // Suppress "end of stream" — these are TCP-level health probes (e.g. HuggingFace Spaces)
588
+ // that connect and disconnect without sending an HTTP request; not a real error.
589
+ if (e.code() != http::error::end_of_stream)
590
+ log_line("session_exception=" + std::string(e.what()));
591
  } catch (const std::exception &e) {
592
  log_line("session_exception=" + std::string(e.what()));
593
  } catch (...) {