bug-2409-xmlrpc.patch

Tino Vázquez, 10/25/2013 12:41 PM

Download (3.83 KB)

View differences:

include/RequestManager.h
107 107
    int socket_fd;
108 108

  
109 109
    /**
110
     *  Max connections
111
     */
112
    int max_conn;
113

  
114
    /*
115
     *  Max backlog connections
116
     */
117
    int max_conn_backlog;
118

  
119
    /*
120
     *  Keepalive timeout
121
     */
122
    int keepalive_timeout;
123

  
124
    /*
125
     *  Keepalive max conn
126
     */
127
    int keepalive_max_conn;
128

  
129
    /*
130
     *  Timeout
131
     */
132
    int timeout;
133

  
134
    /**
110 135
     *  Filename for the log of the xmlrpc server that listens
111 136
     */
112 137
    string xml_log_file;
src/oca/ruby/OpenNebula.rb
145 145
                @one_endpoint = "http://localhost:2633/RPC2"
146 146
            end
147 147

  
148
            @server = XMLRPC::Client.new2(@one_endpoint)
148
            @server = XMLRPC::Client.new2(@one_endpoint, nil, 1)
149 149

  
150 150
            if OpenNebula::NOKOGIRI
151 151
                @server.set_parser(NokogiriStreamParser.new)
src/rm/RequestManager.cc
77 77
extern "C" void * rm_xml_server_loop(void *arg)
78 78
{
79 79
    RequestManager *    rm;
80
    Nebula& nd = Nebula::instance();
81
    string str;
82
    ostringstream oss;
83
    unsigned int max_conn = 15;
84
    unsigned int max_conn_backlog = 15;
85
    unsigned int keepalive_timeout = 15;
86
    unsigned int keepalive_max_conn = 30;
87
    unsigned int timeout = 15;
80 88
        
81 89
    if ( arg == 0 )
82 90
    {
......
84 92
    }
85 93

  
86 94
    rm = static_cast<RequestManager *>(arg);
87
 
95

  
96
    // Get configuration parameters
97

  
98
    // MAX_CONN
99
    nd.get_configuration_attribute("MAX_CONN", str);
100
    if (!str.empty())
101
    {
102
        max_conn = atoi(str.c_str());
103
    }
104

  
105
    oss << "max_conn: " << max_conn;
106
    NebulaLog::log("ReM",Log::DEBUG, oss);
107

  
108
    // MAX_CONN_BACKLOG
109
    nd.get_configuration_attribute("MAX_CONN_BACKLOG", str);
110
    if (!str.empty())
111
    {
112
        max_conn_backlog = atoi(str.c_str());
113
    }
114

  
115
    oss.str("");
116
    oss << "max_conn_backlog: " << max_conn_backlog;
117
    NebulaLog::log("ReM",Log::DEBUG, oss);
118

  
119
    // KEEPALIVE_TIMEOUT
120
    nd.get_configuration_attribute("KEEPALIVE_TIMEOUT", str);
121
    if (!str.empty())
122
    {
123
        keepalive_timeout = atoi(str.c_str());
124
    }
125

  
126
    oss.str("");
127
    oss << "keepalive_timeout: " << keepalive_timeout;
128
    NebulaLog::log("ReM",Log::DEBUG, oss);
129

  
130
    // KEEPALIVE_MAX_CONN
131
    nd.get_configuration_attribute("KEEPALIVE_MAX_CONN", str);
132
    if (!str.empty())
133
    {
134
        keepalive_max_conn = atoi(str.c_str());
135
    }
136

  
137
    oss.str("");
138
    oss << "keepalive_max_conn: " << keepalive_max_conn;
139
    NebulaLog::log("ReM",Log::DEBUG, oss);
140

  
141
    // TIMEOUT
142
    nd.get_configuration_attribute("TIMEOUT", str);
143
    if (!str.empty())
144
    {
145
        timeout = atoi(str.c_str());
146
    }
147

  
148
    oss.str("");
149
    oss << "timeout: " << timeout;
150
    NebulaLog::log("ReM",Log::DEBUG, oss);
151

  
88 152
    // Set cancel state for the thread
89 153
    
90 154
    pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,0);
......
96 160
    rm->AbyssServer = new xmlrpc_c::serverAbyss(xmlrpc_c::serverAbyss::constrOpt()
97 161
        .registryP(&rm->RequestManagerRegistry)
98 162
        .logFileName(rm->xml_log_file)
163
        .maxConn(max_conn)
164
        .maxConnBacklog(max_conn_backlog)
165
        .keepaliveTimeout(keepalive_timeout)
166
        .keepaliveMaxConn(keepalive_max_conn)
167
        .timeout(timeout)
99 168
        .socketFd(rm->socket_fd));
100 169
        
101 170
    rm->AbyssServer->run();