Galeon and Thunar

Brian J. Tarricone bjt23 at cornell.edu
Wed Feb 21 21:08:35 CET 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 21 Feb 2007 13:50:57 -0600 Scott T. Hildreth wrote:

> On Sat, 2007-02-17 at 15:31 -0800, Brian J. Tarricone wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: RIPEMD160
> > 
> > Scott T. Hildreth wrote:
> > > On Thu, 2007-02-15 at 06:32 -0600, Scott T. Hildreth wrote:
> > >> On Thu, 2007-02-15 at 08:27 +0100, Nick Schermer wrote:
> > >>> On Wed, 14 Feb 2007 20:32:26 -0600, "Scott T. Hildreth"
> > >>> <shild at sbcglobal.net> wrote:
> > >>>>     I just ran the panel from the command line, trying to see
> > >>>> if I could see info printed to the term when I tried the
> > >>>> search for the weather plugin. 
> > >>> Is the weather plugin not available in the add dialog?
> > >>   I worded that wrong.  I meant to say that I am using the
> > >> "Search" of the weather plugin and it is not doing anything.  So
> > >> I was hopping to see some debug info in the term.  I can strace
> > >> the process to see what happens during the search.
> > > 
> > > close(6)                                = 0
> > > socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 6
> > > fcntl(6, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
> > > connect(6, {sa_family=0x20 /* AF_??? */, sa_data="main\' below
> > > wi"}, 16) = -1 EINPROGRESS (Operation now in progress)
> > > ioctl(3, FIONREAD, [1948280948])        = 0
> > > gettimeofday({1679844712, 1767992687}, NULL) = 0
> > > poll([{fd=3, events=POLLIN}], 1, 0)     = 0
> > > write(3,
> > > "5\20\4\0D\f`\2\311\t`\2o\0\34\0\232\4\5\0E\f`\2D\f`\002"...,
> > > 1996) = 1996 ioctl(3, FIONREAD, [0])                 = 0
> > > gettimeofday({329370, 39849029}, NULL)  = 0
> > > poll([{fd=3, events=POLLIN}], 1, 0)     = 0
> > > sendto(6, "GET /search/search?where=60188 H"..., 67, 0, NULL, 0)
> > > = -1 ENOTCONN (Socket is not connected)
> > > close(6)                                = 0
> > 
> > from the EINPROGRESS return from connect(), it looks like the
> > plugin is using non-blocking sockets.  The ENOTCONN could be
> > because the connect did not complete yet.
> > 
> > Looking at the code, yeah, the http stuff doesn't actually check to
> > see if the connect completed before writing to the socket.  After
> > calling connect(), it needs to select() on the socket (check for
> > ability to write), then call getsockopt(fd, SOL_SOCKET,
> > SO_ERROR,...) to ensure the connect() completed successfully.[1]
> > 
> > Feel free to file a bug against the weather plugin with roughly this
> > information...
> 
> So I hacked this into weather-http.c - the http_connect() function
> and it works now.  Thanks Brian.  Nick should I make a bug report?
> 
> 
>   else {
>       gint iters_left;
> 
>       for (iters_left = 25; iters_left >= 0; iters_left--) {
> 
>           fd_set wfd;
>           struct timeval tv = { 2, 0 };
>           int sock_err = 0;
>           socklen_t sock_err_len = sizeof(int);
>           gpointer msg;
> 
>           FD_ZERO(&wfd);
>           FD_SET(fd, &wfd);
> 
>           DBG("checking for a connection...");
> 
>           /* wait until the connect attempt finishes */
>           if(select(FD_SETSIZE, NULL, &wfd, NULL, &tv) < 0)
>               break;
> 
>           /* check to see if it finished, and, if so, if there was an
>            * error, or if it completed successfully */
>           if(FD_ISSET(fd, &wfd)) {
>               if (!getsockopt(fd, SOL_SOCKET, SO_ERROR, &sock_err,
> &sock_err_len) && !sock_err)
>               {
>                   DBG("    connection succeeded");
>               } else {
>                   DBG("    connection failed: sock_err is %d",
> sock_err); }
>               break;
>           }
> 
>       }
> 
>       return fd;

Feel free to file a bug and attach a patch.  I'm not sure if that's the
right fix in this case.  If the network stuff is done in the main
thread in the weather plugin, this code will block the UI until it
either succeeds or fails.  The mailwatch plugin example I gave does all
network I/O in a separate thread, so it's not an issue.  But at least
something similar to what you did will need to be implemented.

	-brian

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFF3KbJ6XyW6VEeAnsRAnKNAJ4rEx1eaiT/8VUfizFy5XxwEhBMLQCg8MOs
CwaTHwibUfLB9dJSBP+Vkp4=
=lXYR
-----END PGP SIGNATURE-----


More information about the Xfce mailing list