Re: Perl-Glib and libsoup issues



I've put my reply as an attachment because editing in the browser is a pain. Please let me know if anybody's 
has trouble viewing it.

Thanks
Sameer




Need a new email address that people can remember
Check out the new EudoraMail at
http://www.eudoramail.com

: On Thursday, April 29, 2004, at 05:40 PM, Sameer VK wrote:
: 
: > I'm trying to debug an issue with Perl-Glib and libsoup (HTTP library 
: > using Glib). I've set up a Perl interface to some C/C++ libraries that 
: > run on top of Glib and libsoup, using Perl-Glib and its mainloop.
: 
: did you use gperl.h or your own XS glue?

My own - well, SWIG + some stuff from perlcall.

: if you don't use the 
: functions and typemaps provided by the Glib module for wrapping objects 
: and such, then it's quite tricky to get things to interoperate.

as I see!

 Here're the layers:
 
0 Perl script              --> use Glib; MainLoop->run happens here
1 Perl interface to o_http --> XS/Perl API
2 C++ library (o_http)     --> C++ call to send/recv HTTP msgs.
3 libsoup-1.99.26          --> IOChannel for async HTTP reqs.
4 libglib-2.0              --> C mainloop run
 
: > The interface works fine upto a point. Using gdb, I can trace all the 
: > way down to where a soup message function queues a message (event?) 
: > for execution - a call to a Web server. But Glib does not seem to be 
: > doing anything with the message or its related callback - no connect 
: > calls using strace, for instance.
: 
: is the main loop actually running?

Yes, I'm able to set up timers and callbacks at the Perl script level (0).

: i know nothing about libsoup; can you explain a bit how you're using it 
: and what's happening?

Using a C++ test driver at level 1, I'm able to send and receive HTTP
messages over libsoup. This driver sets up a glib main_loop. I'd like
to replicate this using Perl. So I've set up the main_loop using Perl-Glib.
The script goes to the point where libsoup saves the request in its queue,
presumably for processing, but the actual message is not sent out, no connect shows up in strace, for 
instance.

: a quick grep of the libsoup source shows only a few occurrences of 
: g_main_* ...   the only occurrence of g_main_loop_new(), in 
: soup_server_run(), passes NULL to use the default context.

I'm not relying on libsoup to set up a main_loop. Also, I'm not using the
soup_server code - this is strictly for a client-side app.

: > Is there a way to check whether the context for the mainloop is 
: > different in Perl and C? I tried using the default context when 
: > creating a mainloop, but that didn't make a difference.
: 
: the bindings for this stuff are pretty thin, so i don't see why they 
: shouldn't be the same.  provided you can actually get the context 
: pointer from libsoup, you can check them with a little black magick, 
: but i'd rather not post the details where google will make it available 
: for all to use as an example.  ;-)
: 
: hint: look at the definitions for T_G_MAIN_CONTEXT in Glib/typemap.

I'm sorry to say I've not read up either glib, perl-glib, or libsoup
thoroughly. All this info was gleaned solely from poking around with
gdb and skimming the code. So if incorrect context is the issue here,
sample code on how to check for context would be very helpful.

Given that the main_loop seems to be running, is there a chance the
callback to send the HTTP request is not being called? I see a g_idle_add
in soup-message.c (sets up soup_idle_handle_new_requests). I have a
perl-Glib timer running every second to allow Perl to process any signals.
Could that be a problem?

Thanks
Sameer


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