Browse Source

Fix some server list crashes

Fix /server endpoint JSON never being updated
task/remove_strings
Jessica James 3 years ago
parent
commit
703aa97c53
  1. 5
      src/common/HTTP_Server.cpp

5
src/common/HTTP_Server.cpp

@ -701,8 +701,7 @@ bool Jupiter::HTTP::Server::tls_bind(const Jupiter::ReadableString &hostname, ui
int Jupiter::HTTP::Server::think() { int Jupiter::HTTP::Server::think() {
// Process existing clients // Process existing clients
auto sessions_end = m_data->m_sessions.end(); for (auto itr = m_data->m_sessions.begin(); itr != m_data->m_sessions.end();) {
for (auto itr = m_data->m_sessions.begin(); itr != sessions_end;) {
auto& session = *itr; auto& session = *itr;
if (session->sock.isShutdown()) { if (session->sock.isShutdown()) {
if (session->sock.recv() == 0) { if (session->sock.recv() == 0) {
@ -752,7 +751,7 @@ int Jupiter::HTTP::Server::think() {
// Process incoming clients // Process incoming clients
std::unique_ptr<Jupiter::Socket> socket; std::unique_ptr<Jupiter::Socket> socket;
for (auto& port : m_data->m_ports) { for (auto& port : m_data->m_ports) {
socket.reset(socket->accept()); socket.reset(port->accept());
if (socket != nullptr) { if (socket != nullptr) {
socket->setBlocking(false); socket->setBlocking(false);
auto session = std::make_unique<HTTPSession>(std::move(*socket)); auto session = std::make_unique<HTTPSession>(std::move(*socket));

Loading…
Cancel
Save