Daniel Stenberg a écrit : > On Mon, 25 May 2009, Olivier Hervieu wrote: > >> Attach to this mail, you will find an exemple showing how to makes >> X11 forwarding works with libssh2. This exemple allocates a shell >> where you can request X ressources. > > Thanks! > > But whoa. That's extremely complicated. Is it really necessary to do > it that way just to get X11 forwarding to work? Or perhaps the > question should rather be put: what should we do to libssh2 to make > this a lot less complicated? > Good question! Unfortunately, i'm not an SSH expert. I have make a brief look in other ssh2 clients and X11 forwarding looks as complicated as in libssh2. In fact, for each X11 resources requested, a new channel is created and we have to associate it with a socket connected to our X11 server for data exchange. So we have to managed a list of channels and "X11 socket". I don't see how to make this less complicated... specially if you want to depreciate libssh2_poll (we can imagine that libssh2 handles a channel list and give a pointer on a channel that have data to read).
> The example is full of flaws as well: > > A) why wait for 10 *microseconds* in the select() used in the main > function? > Why not 10 seconds or something? > > B) the select() in x11_send_receive() does no timeout at all but why > is there > a select() at all? libssh2 sets the socket to a non-blocking state by > itself so you can't block on the read() call done there anyway. > > C) libssh2_poll() is deprecated and should not be used and I also > can't see > the point with its use in the example > The select/poll part is ugly (as I said in my precedent post). The entry point for this exemple was the ssh2.c file and, for now, this exemple must be consider as a proof of concept. Time is my enemy and I wish I could have more time to do things better. I'm gonna remove libssh2_poll parts, and replace it by a poll system call. That will be solve points A) B) and C). > I also re-indented it somewhat to better adhere to our style and I > removed a bunch of compiler warnings. The current version is attached. > Sorry for that. Regards -- Olivier Hervieu - olivier.herv...@wallix.com Pôle Produits / Security Research and Development http://www.wallix.com WALLIX, 118 Rue de Tocqueville 75017 paris ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://www.creativitycat.com _______________________________________________ libssh2-devel mailing list libssh2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-devel