14 if ((node = conf->
obj()[
"servers"])) {
15 lst = conf->
obj()[
"servers"]->lst();
16 for (std::vector<JSONNode *>::iterator it = lst.begin(); it < lst.end(); it++) {
19 std::vector<Master *> tmp_s = server->
get_sockets(*it);
23 if ((node = conf->
obj()[
"allowed_methods"])) {
25 for (JSONList::iterator it = lst.begin(); it < lst.end(); it++) {
29 }
catch (std::exception &e) {
30 std::cerr << e.what() <<
"\n";
41 for (std::vector<Server *>::iterator it = this->
_servers.begin(); it < this->
_servers.end(); it++) {
44 for (std::vector<Master *>::iterator it = this->
_masters.begin(); it < this->
_masters.end(); it++) {
59 cout <<
"|===||===| Waiting some HTTP request... |===||===|\n";
61 if ((activity < 0) && (errno != EINTR))
62 std::cerr <<
"Select: " << strerror(errno) <<
"\n";
68 cout <<
"==> Check sockets still alive to listen\n";
69 for (std::vector<Master *>::iterator it = this->
_masters.begin(); it < this->
_masters.end(); it++)
78 cout <<
"==> Handle requests and answers:\n";
79 for (std::vector<Master *>::iterator it = this->
_masters.begin(); it < this->
_masters.end(); it++)
81 (*it)->post_select(
this);
82 }
catch (std::exception &e) {
83 std::cerr << e.what();
void cycle(void)
A Wevserv cycle:
void post_select(void)
Refresh all master_sockets and their clients datas (disconnect, new connection, etc....
std::vector< Master * > _masters
std::vector< Server * > _servers
void pre_select(void)
Append each master_sockets and their clients to list of fds SELECT must look at.
vec_string _allowed_methods
static int _amount
< The higher one
static int _max_fd
< The lower socket fd
static int _min_fd
< The sockets fd which will be select
std::vector< Master * > get_sockets(JSONNode *server)
Create server's defined sockets:
std::vector< JSONNode * > JSONList