cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: issue with quick reconnect

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 17 Aug 2009 14:01:33 +0200 (CEST)

On Fri, 14 Aug 2009, Jogeshwar Karthik Akundi wrote:

I stopped responding to the curl-users list as that's wrong place for this.
And I'll try not to get too upset for your top-post. Please educate yourself
with our netiquette and adapt.

> Unfortunately at this point I cannot share the source code with all.
> But at a very high level it is like this:

Then accept that I cannot help a lot but I can throw some guesses around!

> curl_easy_getinfo(m_curlHandle, CURLINFO_LASTSOCKET, &sock);

This is an action you must be aware of can fail. You should check the return
code carefully.

> Initially, after a successful connection, I do a write operation using
> curl_easy_send() and then do a curl_easy_recv(). the send operation is also
> going fine but I get this error in the receive operation.

And why do you think this is a libcurl problem? Isn't it simply some problem
with the remote server?

The CONNECT_ONLY is a bit of a black sheep in the libcurl code. I figure it
might have bugs around. I can't recall now if the connection is even
unconditionally closed after you cleanup it, or if there's risk that you
actually re-use it and then we have no proper way to know things are fine and
suitable for re-use. Have you check that it actually closes the connection on
each cleanup call?

> I googled for this and found some more info: *easy_connection() *method in
> easy.c logs this error (*Failed to get recent socket*) when the sockfd is -1
> and the returned curl code is 1.

Yes, as libcurl does not guarantee that it can in fact return the last used
socket.

> But here my connection is going through fine and the initial
> curl_easy_send() is also being successful so I am baffled as to what could
> have gone wrong

debugger? strace? printfs()?

-- 
  / daniel.haxx.se
Received on 2009-08-17