Galeon and Thunar

Scott T. Hildreth shild at sbcglobal.net
Wed Feb 21 20:50:57 CET 2007


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;

> 
> 	-brian
> 
> [1] Example of this is here:
> http://svn.xfce.org/svn/goodies/xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-mailbox-imap.c
> (grep for EINPROGRESS)
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.2 (GNU/Linux)
> 
> iD8DBQFF15BW6XyW6VEeAnsRA+OaAJ41N4V70GaMiXGPhRVGxIhS5oRjfQCfTTXS
> uIHGavXths5xEEdgRaaZFAQ=
> =5YbU
> -----END PGP SIGNATURE-----
> _______________________________________________
> Xfce mailing list
> Xfce at xfce.org
> http://foo-projects.org/mailman/listinfo/xfce
> http://www.xfce.org
-- 
Scott T. Hildreth <shild at sbcglobal.net>



More information about the Xfce mailing list