I agree, I'll change it to support a list of fallbacks and all will be
encapsulated in socket.

However, I still see some issues.

On one side of things (luaa.c) we observe the error when BINDing to the
socket, on the other (awesome-client.c) we observe the error when CONNECTing
to the socket.

I believe the cleanest solution would be to add a paramter to socket_getaddr
(and change its name of the function to something more descriptive) that
decides if we are opening the socket to bind or connect, and in either case
that is performed inside the function (it would receive csfd as parameter as
well).

That function would then take care of all the fallback logic and print out
any warning/error messages. What do you think?

Alex


On Thu, Mar 19, 2009 at 3:57 AM, Julien Danjou <[email protected]> wrote:

> At 1237393978 time_t, Alex Cornejo wrote:
> > We could certainly add this, although doing 3 checks with the current
> method
> > (if bla do x, else if bla1 do x, else if bla2 do x) would be IMHO poor
> > programming practice.
>
> Reading man page, you don't have a choice. There's only bind() to create
> such a socket.
>
> > If we want to have 3 fallbacks, we could just support a list of fallback
> > directories. The main problem I see here is how to test if a socket can
> be
> > created in a directory without calling bind. If this could be done we
> could
> > insert all this logic in socket_getaddr and revert the patch on
> > awesome-client.c and luaa.c.
>
> All fallback logic should be in common/socket.c. Currently it is
> duplicated, and it's bad.
>
> Cheers,
> --
> Julien Danjou
> // ᐰ <[email protected]>   http://julien.danjou.info
> // 9A0D 5FD9 EB42 22F6 8974  C95C A462 B51E C2FE E5CD
> // When I get sad, I stop being sad and be awesome instead. True story.
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAknB+toACgkQpGK1HsL+5c3a3gCg24v+kpkXqOkLyFZgJL2Lym4G
> U1QAn2vtGFegPTJe2kQhcPiDC+J7Zzw1
> =NB2u
> -----END PGP SIGNATURE-----
>
>

Reply via email to