Re: [Vala] libvfcgi 0.0.1



Hi Mike,

I'm having SEGV trouble when constructing a FastCGI.Server, but I'm not
sure if I'm dealing with a libvfcgi or valac issue. I've reduced the
problem to the following code:

 public class Server : GLib.Object {
   private ThreadedSocketService m_service;
   private uint16 m_max_connections;

   public Server() {
     m_max_connections = (uint16)FastCGI.server_max_connections;
     m_service = new ThreadedSocketService(m_max_connections);
     m_service.max_threads = m_max_connections;
   }
 }


This produces (in my valac v0.7.8, at least) the following warning:

server.vala:8.7-8.27: warning: assigning to construct-only properties is
deprecated, use Object (property: value) constructor chain up
     m_service.max_threads = m_max_connections;
     ^^^^^^^^^^^^^^^^^^^^^

...and the following C...:

Server* server_construct (GType object_type) {
       GParameter * __params;
       GParameter * __params_it;
       GThreadedSocketService* _tmp0_;
       Server * self;
       __params = g_new0 (GParameter, 1);
       __params_it = __params;
       self->priv->m_max_connections = (guint16)
fast_cgi_server_max_connections;
      ...

Your code seems obvious and intuitive, but I assume there must be a
reason this is not accepted by the compiler (also, shouldn't this
warning really be an error?)

Not sure how to proceed as the suggested solution implies constructing
ThreadedSocketServer() without yet knowing the value of
m_max_connections. I've tried several alternatives, but I'm afraid I'm
too new at vala to come up with something that works.


-Darren














Any chance you could:



- Tell me which version of vala you're currently using
- Send me your server.c

For what it's worth, my valac v0.7.8 generates the following code:

FastCGIServer* fast_cgi_server_construct (GType object_type, GError**
error) {
       GError * _inner_error_;
       GParameter * __params;
       GParameter * __params_it;
       char* _tmp0_;
       GThreadedSocketService* _tmp1_;
       FastCGIServer * self;
       FastCGIRequestRequestAbortFunc _tmp2_;
       GList* _tmp3_;
       GList* _tmp4_;
       GObject* _tmp5_;
       GObject* _tmp6_;
       _inner_error_ = NULL;
       __params = g_new0 (GParameter, 1);
       __params_it = __params;
       self->priv->m_port_number = (guint16) fast_cgi_server_listen_port;



-Darren


Michael B. Trausch wrote:
Hi,

Some people on the list indicated interest in progress on a FastCGI
library for Vala.  I have released v0.0.1 of the libvfcgi library.
Please tell me if announcements of future releases of this library are
welcome here on this list.

Libvfcgi is a library that implements FastCGI for GObject and Vala
applications, written in Vala. It aims to fully implement the FastCGI
specification and make FastCGI Web application servers accessible to
Vala programmers and GObject C programmers. Note that while it is
possible to use the library from GObject C, it is designed for use with
Vala and may be tedious to use directly in C.

Version 0.0.1 doesn't do anything useful yet.  It lays the foundation,
however.  It builds (with a lot of warnings at the moment; a perfectly
clean build is a high-priority goal, but for the moment it's highly
likely that the code is blatantly incorrect and thus the warnings, it's
a "first draft" of sorts), but it has not been put to use since there is
no way to test it just yet.  What will be happening is that I plan to
have a 0.0.2 release in two weeks that adds the following things on the
base:

 * Support for handling the Responder FastCGI role, which is the
   role that most FastCGI applications will want to use normally.
 * Handle management records.

The 0.0.2 release will be the first release that one will be able to
actually use to write a useful FastCGI application in Vala.  My plan is
to have it released in 2 to 3 weeks.

libvfcgi installs as libvfcgi0.  It uses the GNU build system, and
working with the source code from the VCS trunk branch requires that you
have at least the following:

  * Vala 0.7.6 (present in Ubuntu Karmic)
  * Automake 1.11 (present in Ubuntu Karmic)
  * Autoconf 2.60 (Karmic has 2.64)
  * GLib 2.22 or newer.
  * GIO 2.22 or newer.

The project is available on Launchpad and uses the bzr version control
system.  The project page is located at:

  https://launchpad.net/libvfcgi

The library is licensed under the terms of the GNU LGPL v3.0.  When
"make install" is done, the vapi file will be installed in the Vala VAPI
directory (as determined by "pkg-config --variable=vapidir vala-1.0",
or, if that isn't available, by checking /usr/share/vala/vapi
and /usr/local/share/vala/vapi for glib-2.0.vapi directly) if one is
present and findable.  (Is there a better way to do this, say, by asking
Vala where it stores those things directly?)

Questions, comments, patches, etc., are all welcome.  I know that Vala
uses git, but I can't do a project in git.  If someone knows how to
setup a one-way git mirror of bzr projects, I'd like to know about it so
that it can be linked to from the Launchpad project page.

Patches are preferred as bzr branches on Launchpad, but a bzr merge
directive or output from bzr diff, git diff, or diff -urN is also
perfectly fine.  Patches that do not come in a manner that bzr
understands natively will have the "author" attribute on the commit
marked to be the name and email address on the email that I get that has
the commit on it, unless requested otherwise.

        Happy hacking,
        Mike






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