Merge branch 'master' into jgrpp
Replace build and refit, and group collapse implementations Fix template creation build and refit # Conflicts: # Makefile.bundle.in # config.lib # src/animated_tile.cpp # src/blitter/32bpp_anim.hpp # src/blitter/32bpp_base.hpp # src/blitter/8bpp_base.hpp # src/blitter/null.hpp # src/build_vehicle_gui.cpp # src/command.cpp # src/command_func.h # src/console_gui.cpp # src/core/smallstack_type.hpp # src/date.cpp # src/debug.cpp # src/genworld_gui.cpp # src/ground_vehicle.hpp # src/group_gui.cpp # src/lang/korean.txt # src/linkgraph/linkgraph_gui.h # src/main_gui.cpp # src/misc_gui.cpp # src/network/core/game.h # src/network/core/packet.cpp # src/network/core/udp.cpp # src/network/core/udp.h # src/network/network_content.cpp # src/network/network_type.h # src/network/network_udp.cpp # src/newgrf_house.h # src/openttd.cpp # src/order_cmd.cpp # src/order_gui.cpp # src/os/unix/crashlog_unix.cpp # src/os/windows/crashlog_win.cpp # src/osk_gui.cpp # src/pathfinder/opf/opf_ship.cpp # src/rail_cmd.cpp # src/rail_gui.cpp # src/saveload/saveload.cpp # src/settings.cpp # src/settings_gui.cpp # src/smallmap_gui.h # src/station_base.h # src/station_cmd.cpp # src/table/gameopt_settings.ini # src/table/newgrf_debug_data.h # src/table/settings.ini # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/train_gui.cpp # src/vehicle.cpp # src/vehicle_gui.cpp # src/vehiclelist.cpp # src/viewport.cpp # src/widgets/dropdown.cpp # src/window_gui.h
This commit is contained in:
@@ -11,8 +11,6 @@
|
||||
* @file tcp_http.cpp Basic functions to receive and send HTTP TCP packets.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "../../debug.h"
|
||||
#include "../../rev.h"
|
||||
@@ -23,7 +21,7 @@
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/** List of open HTTP connections. */
|
||||
static SmallVector<NetworkHTTPSocketHandler *, 1> _http_connections;
|
||||
static std::vector<NetworkHTTPSocketHandler *> _http_connections;
|
||||
|
||||
/**
|
||||
* Start the querying
|
||||
@@ -65,7 +63,7 @@ NetworkHTTPSocketHandler::NetworkHTTPSocketHandler(SOCKET s,
|
||||
return;
|
||||
}
|
||||
|
||||
*_http_connections.Append() = this;
|
||||
_http_connections.push_back(this);
|
||||
}
|
||||
|
||||
/** Free whatever needs to be freed. */
|
||||
@@ -299,21 +297,21 @@ int NetworkHTTPSocketHandler::Receive()
|
||||
/* static */ void NetworkHTTPSocketHandler::HTTPReceive()
|
||||
{
|
||||
/* No connections, just bail out. */
|
||||
if (_http_connections.Length() == 0) return;
|
||||
if (_http_connections.size() == 0) return;
|
||||
|
||||
fd_set read_fd;
|
||||
struct timeval tv;
|
||||
|
||||
FD_ZERO(&read_fd);
|
||||
for (NetworkHTTPSocketHandler **iter = _http_connections.Begin(); iter < _http_connections.End(); iter++) {
|
||||
FD_SET((*iter)->sock, &read_fd);
|
||||
for (NetworkHTTPSocketHandler *handler : _http_connections) {
|
||||
FD_SET(handler->sock, &read_fd);
|
||||
}
|
||||
|
||||
tv.tv_sec = tv.tv_usec = 0; // don't block at all.
|
||||
int n = select(FD_SETSIZE, &read_fd, NULL, NULL, &tv);
|
||||
if (n == -1) return;
|
||||
|
||||
for (NetworkHTTPSocketHandler **iter = _http_connections.Begin(); iter < _http_connections.End(); /* nothing */) {
|
||||
for (auto iter = _http_connections.begin(); iter < _http_connections.end(); /* nothing */) {
|
||||
NetworkHTTPSocketHandler *cur = *iter;
|
||||
|
||||
if (FD_ISSET(cur->sock, &read_fd)) {
|
||||
@@ -323,7 +321,7 @@ int NetworkHTTPSocketHandler::Receive()
|
||||
if (ret <= 0) {
|
||||
/* Then... the connection can be closed */
|
||||
cur->CloseConnection();
|
||||
_http_connections.Erase(iter);
|
||||
iter = _http_connections.erase(iter);
|
||||
delete cur;
|
||||
continue;
|
||||
}
|
||||
@@ -331,5 +329,3 @@ int NetworkHTTPSocketHandler::Receive()
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
Reference in New Issue
Block a user