• R/O
  • SSH

fcfserver: Commit

Server application performing load balancing and monitoring of nodejs applications


Commit MetaInfo

Révision960b3fd2cb755373baf7f2eba3a1babd7ee73019 (tree)
l'heure2022-06-14 15:55:13
AuteurVladimir Markin
CommiterVladimir Markin

Message de Log

fix

Change Summary

Modification

diff -r a817690db4cb -r 960b3fd2cb75 endpoint.cpp
--- a/endpoint.cpp Tue Jun 14 03:49:33 2022 +0300
+++ b/endpoint.cpp Tue Jun 14 09:55:13 2022 +0300
@@ -136,7 +136,7 @@
136136 argv1.push_back("--port");
137137 argv1.push_back(std::to_string(hc.dataPorts[procindex*2]));
138138 argv1.push_back("--host");
139- argv1.push_back("localhost");
139+ argv1.push_back("127.0.0.1");
140140 argv1.push_back("--keep-alive-timeout");
141141 argv1.push_back(std::to_string(hc.keepAliveTimeout ? hc.keepAliveTimeout + 5: 0));
142142
@@ -170,7 +170,7 @@
170170 argv2.push_back("--port");
171171 argv2.push_back(std::to_string(hc.dataPorts[procindex*2+1]));
172172 argv2.push_back("--host");
173- argv2.push_back("localhost");
173+ argv2.push_back("127.0.0.1");
174174 argv2.push_back("--keep-alive-timeout");
175175 argv2.push_back(std::to_string(hc.keepAliveTimeout ? hc.keepAliveTimeout + 10: 0));
176176 if (!!procindex) {
@@ -365,7 +365,7 @@
365365 boost::uuids::uuid debug_client_uuid = boost::uuids::random_generator()();
366366 bool request_timeout_error = false;
367367
368-
368+ fcf::tst << "001";
369369 try {
370370 while(true) {
371371 std::chrono::time_point start_request = std::chrono::system_clock::now();
@@ -404,6 +404,8 @@
404404 continue;
405405 }
406406
407+ fcf::tst << "002";
408+
407409 if (!first_transaction && first_request)
408410 a_socket->set_timeout(client_socket_timeout);
409411
@@ -423,9 +425,11 @@
423425 break;
424426 }
425427
428+ fcf::tst << "003";
426429 if (break_loop)
427430 break;
428431
432+ fcf::tst << "004";
429433 fcf::trc << "Request: " << a_socket->get_address() << ": PORT:" << a_socket->get_port() << "; Path: " << request_header_info.path;
430434
431435 first_transaction = false;
@@ -522,6 +526,7 @@
522526 }
523527 }
524528
529+ fcf::tst << "005";
525530 // reconnect to process
526531 const handler_configuration_t& handler_config(_config.handlers[new_handler_index]);
527532
@@ -540,11 +545,16 @@
540545 sps = &(_subprocesses[_config.handlers[handler_index].name]->get_process_info(process_index));
541546 if (process_socket)
542547 process_socket->close();
548+ fcf::tst << "005-001: " << sps->real_port;
543549 process_socket.reset(fcf::net::create_socket("127.0.0.1", sps->real_port));
550+ fcf::tst << "005-002";
544551 process_socket->set_timeout(server_socket_timeout);
552+ fcf::tst << "005-003";
545553 process_socket->connect();
546554 }
547555
556+ fcf::tst << "006";
557+
548558 // send header with data
549559 offset = 0;
550560 {
@@ -558,6 +568,8 @@
558568 }
559569 }
560570
571+ fcf::tst << "007";
572+
561573 // send residual message to process
562574 offset = 0;
563575 if (!is_big_data) {
@@ -588,6 +600,8 @@
588600 }
589601 }
590602
603+ fcf::tst << "008";
604+
591605 // get response
592606 std::chrono::time_point start_response = std::chrono::system_clock::now();
593607 offset = 0;
@@ -615,6 +629,8 @@
615629 break;
616630 }
617631
632+ fcf::tst << "009";
633+
618634 // send header with data to client
619635 full_pack = response_header_info.content_length + response_header_info.header_end + 4;
620636 offset = 0;
@@ -642,6 +658,8 @@
642658 throw fcf::except::max_response_timeout_fi(a_socket->get_address(), a_socket->get_port(), request_header_info.host.c_str(), request_header_info.path.c_str());
643659 }
644660
661+ fcf::tst << "010";
662+
645663 // resend data to client
646664 if (!completed) {
647665 while(total_size < full_pack) {
@@ -699,6 +717,8 @@
699717 }
700718 }
701719
720+ fcf::tst << "011";
721+
702722 if (response_header_info.connection != "keep-alive"){
703723 break;
704724 }
@@ -715,6 +735,8 @@
715735 completed = false;
716736 }
717737
738+ fcf::tst << "012";
739+
718740 } catch(const fcf::except::max_request_timeout& e) {
719741 request_timeout_error = true;
720742 fcf::dbg << "IP:" << a_socket->get_address() << " PORT:" << a_socket->get_port() << " " << e.what();
diff -r a817690db4cb -r 960b3fd2cb75 event_server.cpp
--- a/event_server.cpp Tue Jun 14 03:49:33 2022 +0300
+++ b/event_server.cpp Tue Jun 14 09:55:13 2022 +0300
@@ -1624,7 +1624,8 @@
16241624 try { co_await a_client->write_steady_timer.async_wait(boost::asio::use_awaitable); } catch (...){ }
16251625 }
16261626 a_client->write_state = true;
1627- co_await boost::asio::async_write(a_client->socket, boost::asio::buffer(a_message->message), boost::asio::use_awaitable);
1627+ std::vector<char> buffer(a_message->message);
1628+ co_await boost::asio::async_write(a_client->socket, boost::asio::buffer(buffer), boost::asio::use_awaitable);
16281629 a_client->write_state = false;
16291630 a_client->write_steady_timer.cancel_one();
16301631 } catch(const std::exception& e) {
diff -r a817690db4cb -r 960b3fd2cb75 event_server.hpp
--- a/event_server.hpp Tue Jun 14 03:49:33 2022 +0300
+++ b/event_server.hpp Tue Jun 14 09:55:13 2022 +0300
@@ -210,14 +210,14 @@
210210 std::vector<process_identification_t> processes;
211211 std::set<process_identification_t> progress;
212212 message_header_t header;
213- std::vector<char> message;
213+ std::shared_ptr< std::vector<char> > message;
214214 std::vector<char> error;
215215 std::vector<char> result;
216216 client_t::client_sp spclient;
217217 bool complete;
218218
219219 message_t(client_t::client_sp& a_spclient)
220- : spclient(a_spclient), complete(false) { }
220+ : message(new std::vector<char>()), spclient(a_spclient), complete(false) { }
221221
222222 static void build_responce(message_t& a_message);
223223 };
Afficher sur ancien navigateur de dépôt.