Review of gnio, round 2

The last week or so I've spent going through the lowlevel part of gnio
and fixing all the issues I pointed outin my initial review, making it
work fully on win32, writing docs, plus fixing lots of other things I
found. I think this code is now in a state where it is more or less
ready to go into glib. However, I'd like some feedback from people who
know socket programming well and from some win32 people.

The classes that I consider candidates for merging right now are:
 GSocket, GSocketControlMessage, GUnixFDMessage

Additionally I added two interfaces, GInitable and GAsyncInitable that
are needed for GSocket but also useful in general for any class that
requires failable initialization after construction. So, please review
those too.

The code is availible in the gnio repo on

Some open question:

No GSocket methods are virtual, so its not possible to subclass GSocket
and override methods to e.g. create a TLS/SSL socket. The current TLS
code in gnio works on the higher level stream objects rather than the
socket object, but it would possibly be interesting to have TLS at the
GSocket level too. This would mean making all GSocket methods indirect.

The name "GInitable" isn't really all that great, but it is short, easy
to spell and describes it well (the method is called "init" after all).
Other possible names are GInitializable, GInitiable, and GHasInit, but
none strikes me as better.

The prototypes for e.g. g_initable_new() is purposely the same as
g_object_new(). However, if we change it from:
 gpointer g_initable_new (GType          object_type,
			  GCancellable  *cancellable,
			  GError       **error,
			  const gchar   *first_property_name,
 gpointer g_initable_new (GType          object_type,
			  GCancellable  *cancellable,
			  GError       **error,
we could add a G_GNUC_NULL_TERMINATED marker so that missing NULLs would
cause a warning. This isn't possible with the g_object_new() prototype,
because then g_object_type (G_TYPE_FOO, NULL) would cause a warning.
However, this would mean the prototypes would differ from the more
commonly used g_object_new(). Does this matter?

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