@@ -46,54 +46,24 @@ HandlerQueue::HandlerQueue() {
4646 m_write_fd = filedes[1 ];
4747};
4848
49- namespace {
50-
51- // Simple debug function for getting information from libcurl; to enable, you
52- // need to recompile with GetHandle(true);
53- int dump_header (CURL *handle, curl_infotype type, char *data, size_t size,
54- void *clientp) {
55- (void )handle;
56- (void )clientp;
57-
58- switch (type) {
59- case CURLINFO_HEADER_OUT:
60- printf (" Header > %s\n " , std::string (data, size).c_str ());
61- break ;
62- default :
63- printf (" Info: %s" , std::string (data, size).c_str ());
64- break ;
49+ CURL *HandlerQueue::GetHandle () {
50+ if (!m_handles.empty ()) {
51+ CURL *result = m_handles.top ();
52+ m_handles.pop ();
53+ return result;
6554 }
66- return 0 ;
67- }
6855
69- } // namespace
70-
71- CURL *GetHandle (bool verbose) {
7256 auto result = curl_easy_init ();
7357 if (result == nullptr ) {
7458 return result;
7559 }
7660
7761 curl_easy_setopt (result, CURLOPT_USERAGENT, " xrootd-s3/devel" );
78- curl_easy_setopt (result, CURLOPT_DEBUGFUNCTION, dump_header);
79- if (verbose)
80- curl_easy_setopt (result, CURLOPT_VERBOSE, 1L );
81-
8262 curl_easy_setopt (result, CURLOPT_BUFFERSIZE, 32 * 1024 );
8363
8464 return result;
8565}
8666
87- CURL *HandlerQueue::GetHandle () {
88- if (!m_handles.empty ()) {
89- CURL *result = m_handles.top ();
90- m_handles.pop ();
91- return result;
92- }
93-
94- return ::GetHandle (false );
95- }
96-
9767void HandlerQueue::RecycleHandle (CURL *curl) { m_handles.push (curl); }
9868
9969void HandlerQueue::Produce (HTTPRequest *handler) {
@@ -233,7 +203,7 @@ void CurlWorker::Run() {
233203
234204 auto curl = queue.GetHandle ();
235205 if (curl == nullptr ) {
236- m_logger.Log (LogMask::Debug , " Run" ,
206+ m_logger.Log (LogMask::Warning , " Run" ,
237207 " Unable to allocate a curl handle" );
238208 op->Fail (" E_NOMEM" , " Unable to get allocate a curl handle" );
239209 continue ;
0 commit comments