Re: Win32 Glib 2.8.x g_io_channel issues (receiving window messages on socket io channel)



On 11/15/05, Tor Lillqvist <tml iki fi> wrote:
There are some problems both in your code, and in giowin32.c.

For efficiency, your code should not read just one byte at a time in
the callback. It should read in bigger chunks, and as much as possible
in a loop, until it gets a WSAEWOULDBLOCK or an EOF. If it did this,
it would probably also work with giowin32.c as it currently is
written.


Eek.  I'm not sure how that avoided notice for so long.  I fixed that
(and what do you know... it works!). Thanks for noticing.

Your code frees the GaimFetchUrlData twice. I don't recall the exact
details, but the call to destroy_fetch_url_data() in gaim_url_fetch()
is unnecessary, if gaim_proxy_connect() returns failure it has already
been called.

That is a result of the hackery that I did to remove the asynchonous
DNS lookup code and etc.  The "real" code actually does this
correctly.

You send a HTTP/1.1 request to the server, meaning it defaults to
using keepalive. You should also send Connection: close, or the server
won't necessarily close it. Or you could shutdown the socket from your
end with shutdown(sock,SD_SEND), then the server will presumably also
close its end after sending the data.


I fixed this as well; we certainly should have been specifying the
"Connection: close" header since we're not handling persistent
connections here.

Anyway, what you originally asked about, the extraneous calls to
WSAEnumNetworkEvents() indeed seem to be quite unnecessary, and are
easy to get rid of. Will do that. Just those extra calls shouldn't
affect how the code works, though. To make this work somewhat more
like on Unix, changes as outlined above are needed to giowin32.c.

Your explanation sheds a lot of light on the situation.  What
surprises me is that this hasn't been causing problems for more
people.  I suppose it is probably because glib 2.8.x isn't in wide
circulation yet in the win32 world.

Should I make an attempt at the changes to giowin32.c, or is that
something you've already got sorted out?

Thanks,
-Daniel


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]