• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisionafa307d5224c197dc0b8726908e92221d5e0cc64 (tree)
Time2013-11-29 14:11:50
AuthorHiroaki Nakano <nakano.hiroaki@nttc...>
CommiterHiroaki Nakano

Log Message

Merge branch 'for_gcc4.7'

Change Summary

Incremental Difference

--- a/l7vsd/include/session_thread_control.h
+++ b/l7vsd/include/session_thread_control.h
@@ -120,7 +120,7 @@ public:
120120 }
121121
122122 //! create up down thread
123- void start_thread();
123+ int start_thread();
124124
125125 //! session shared ptr getter
126126 //! @return session shared ptr
--- a/l7vsd/module/protocol/protocol_module_ip.cpp
+++ b/l7vsd/module/protocol/protocol_module_ip.cpp
@@ -324,7 +324,6 @@ protocol_module_base::check_message_result protocol_module_ip::check_parameter(c
324324 bool timeout_flag = false;
325325 bool reschedule_flag = false;
326326 bool no_reschedule_flag = false;
327- bool forward_checked = false;
328327 bool sorryuri_checked = false;
329328 bool stats_checked = false;
330329
@@ -447,11 +446,6 @@ protocol_module_base::check_message_result protocol_module_ip::check_parameter(c
447446 break;
448447 }
449448 }
450- //option string = "-F"
451- else if (*it == "-F" || *it == "--forwarded-for") {
452- //set forward flag ON
453- forward_checked = true;
454- }
455449 //option string = "-S"
456450 else if (*it == "-S" || *it == "--sorry-uri") {
457451 //set sorryURI flag OFF
@@ -5657,11 +5651,6 @@ bool protocol_module_ip::put_data_into_sendbuffer(
56575651 buffer_element.first += sendbuffer_rest_size;
56585652 buffer_element.second -= sendbuffer_rest_size;
56595653 sendbuffer_rest_size = 0;
5660-
5661- //add remain item
5662- data_ptr->buffer_sequence.push_back(buffer_element);
5663- //delete the item
5664- data_ptr->buffer_sequence.pop_front();
56655654 break;
56665655 }
56675656 }
--- a/l7vsd/module/protocol/protocol_module_ip.h
+++ b/l7vsd/module/protocol/protocol_module_ip.h
@@ -93,8 +93,8 @@ protected:
9393 hash = cl_endpoint.address().to_v4().to_ulong() * GOLDEN_RATIO_PRIME;
9494 } else {
9595 boost::asio::ip::address_v6::bytes_type v6_bytes = cl_endpoint.address().to_v6().to_bytes();
96- boost::asio::ip::address_v4::bytes_type v4_bytes = {{v6_bytes[12], v6_bytes[13], v6_bytes[14], v6_bytes[15]}};
97- boost::asio::ip::address_v4::address_v4 v4_address = boost::asio::ip::address_v4::address_v4(v4_bytes);
96+ const boost::asio::ip::address_v4::bytes_type v4_bytes = {{v6_bytes[12], v6_bytes[13], v6_bytes[14], v6_bytes[15]}};
97+ boost::asio::ip::address_v4 v4_address(v4_bytes);
9898 hash = v4_address.to_ulong() * GOLDEN_RATIO_PRIME;
9999
100100 }
--- a/l7vsd/module/protocol/protocol_module_sessionless.cpp
+++ b/l7vsd/module/protocol/protocol_module_sessionless.cpp
@@ -356,7 +356,6 @@ protocol_module_base::check_message_result protocol_module_sessionless::check_pa
356356 //set check result true
357357 check_message_result check_result;
358358 check_result.flag = true;
359- bool forward_checked = false;
360359 bool sorryuri_checked = false;
361360 bool stats_checked = false;
362361
@@ -405,13 +404,8 @@ protocol_module_base::check_message_result protocol_module_sessionless::check_pa
405404 vec_str_it it_end = args.end();
406405 //loop option strings
407406 for (; it != it_end; ++it) {
408- //option string = "-F"
409- if (*it == "-F" || *it == "--forwarded-for") {
410- //set forward flag ON
411- forward_checked = true;
412- }
413407 //option string = "-S"
414- else if (*it == "-S" || *it == "--sorry-uri") {
408+ if (*it == "-S" || *it == "--sorry-uri") {
415409 //set sorryURI flag OFF
416410 if (!sorryuri_checked) {
417411 //next item exist
--- a/l7vsd/src/l7vsadm.cpp
+++ b/l7vsd/src/l7vsadm.cpp
@@ -2994,9 +2994,8 @@ bool l7vs::l7vsadm::execute(int argc, char *argv[])
29942994
29952995 // Get l7vsadm execute file path from /proc/(pid)/exe (symbolic link)
29962996 char l7vsadm_file_path[256];
2997- ssize_t retsize;
29982997 memset(l7vsadm_file_path, 0, sizeof(l7vsadm_file_path));
2999- retsize = readlink("/proc/self/exe", l7vsadm_file_path, sizeof(l7vsadm_file_path));
2998+ readlink("/proc/self/exe", l7vsadm_file_path, sizeof(l7vsadm_file_path));
30002999
30013000 // L7vsadm command conflict check. (Try l7vsadm execute file lock)
30023001 file_lock lock(l7vsadm_file_path, l7vsadm_err);
--- a/l7vsd/src/logger_impl.cpp
+++ b/l7vsd/src/logger_impl.cpp
@@ -343,9 +343,8 @@ bool l7vs::LoggerImpl::init()
343343 }
344344
345345 // get hostname
346- int ret = 0;
347346 char buff[HOST_NAME_MAX];
348- ret = gethostname(buff, HOST_NAME_MAX);
347+ gethostname(buff, HOST_NAME_MAX);
349348 hostname = buff;
350349
351350 initialized = true;
--- a/l7vsd/src/session_thread_control.cpp
+++ b/l7vsd/src/session_thread_control.cpp
@@ -33,18 +33,18 @@ namespace l7vs
3333 //
3434 //! @brief create up down thread
3535 //
36-void session_thread_control::start_thread()
36+int session_thread_control::start_thread()
3737 {
3838
39- int int_val;
40-
4139 upthread.reset(new boost::thread(&session_thread_control::upstream_run, this)); //! upstream thread create
4240 downthread.reset(new boost::thread(&session_thread_control::downstream_run, this)); //! downstream thread create
4341
4442 //pthread_setschedparam
4543 int retval, sched_policy;
4644 sched_param scheduler_param;
47- int_val = pthread_getschedparam(upthread->native_handle(), &sched_policy, &scheduler_param);
45+ retval = pthread_getschedparam(upthread->native_handle(), &sched_policy, &scheduler_param);
46+ if (retval != 0) return retval;
47+
4848 if (SCHED_FIFO == sched_algorithm) {
4949 scheduler_param.__sched_priority = sched_priority;
5050 sched_policy = SCHED_FIFO;
@@ -56,9 +56,12 @@ void session_thread_control::start_thread()
5656 }
5757 if (0 <= sched_algorithm) {
5858 retval = pthread_setschedparam(upthread->native_handle(), sched_algorithm, &scheduler_param);
59+ if (retval != 0 ) return retval;
5960 retval = pthread_setschedparam(downthread->native_handle(), sched_algorithm, &scheduler_param);
61+ if (retval != 0 ) return retval;
6062 }
6163
64+ return retval;
6265 }
6366
6467 //
--- a/l7vsd/src/virtualservice_base.cpp
+++ b/l7vsd/src/virtualservice_base.cpp
@@ -481,7 +481,7 @@ cpu_set_t l7vs::virtualservice_base::get_cpu_mask(std::string nic_name)
481481 map< size_t, string > cpu_nic_map;
482482 string buff;
483483 ifstream ifs("/proc/interrupts");
484- unsigned int target_interrupt;
484+ //unsigned int target_interrupt;
485485 size_t target_cpuid = 0;
486486 cpu_set_t mask;
487487 sched_getaffinity(0, sizeof(cpu_set_t), &mask);
@@ -503,7 +503,8 @@ cpu_set_t l7vs::virtualservice_base::get_cpu_mask(std::string nic_name)
503503 algorithm::split(split_vec, buff, algorithm::is_any_of(":"));
504504 if (!split_vec.size()) return mask; // cannot split interrupt
505505 algorithm::trim(split_vec[0]);
506- target_interrupt = lexical_cast<unsigned int>(split_vec[0]);
506+ //target_interrupt = lexical_cast<unsigned int>(split_vec[0]);
507+ lexical_cast<unsigned int>(split_vec[0]);
507508 for (size_t i = 0; i < cpu_nic_map.size(); ++i) {
508509 size_t start_position = 4 + (i * 11);
509510 size_t end_position = 11;
--- a/l7vsd/src/virtualservice_tcp.cpp
+++ b/l7vsd/src/virtualservice_tcp.cpp
@@ -30,6 +30,7 @@
3030 #include <boost/format.hpp>
3131 #include <sys/socket.h>
3232 #include <linux/version.h>
33+#include <pthread.h>
3334
3435 #include "virtualservice.h"
3536 #include "logger_enum.h"
@@ -550,6 +551,8 @@ void l7vs::virtualservice_tcp::handle_accept(const l7vs::session_thread_control
550551 */
551552 void l7vs::virtualservice_tcp::initialize(l7vs::error_code &err)
552553 {
554+ int ret = 0;
555+
553556 if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_VIRTUALSERVICE))) {
554557 boost::format formatter("in_function: void virtualservice_tcp::initialize( "
555558 "l7vs::error_code& err )");
@@ -832,7 +835,16 @@ void l7vs::virtualservice_tcp::initialize(l7vs::error_code &err)
832835 session_thread_control *p_stc = new session_thread_control(
833836 sess, vsnic_cpumask, rsnic_cpumask, -1);
834837
835- p_stc->start_thread();
838+ ret = p_stc->start_thread();
839+ if (ret == ESRCH) {
840+ continue;
841+ } else if (ret == EPERM) {
842+ //Error
843+ Logger::putLogError(LOG_CAT_L7VSD_VIRTUALSERVICE, 999, "Not super user authority",
844+ __FILE__, __LINE__);
845+ err.setter(true, "set pthread schedule parameter.");
846+ throw;
847+ }
836848 while (!pool_sessions.push(p_stc)) {}
837849 } catch (...) {
838850 Logger::putLogFatal(