[Openais] Re: just looked at some of the openais code,
have some comments
sdake at mvista.com
Wed Jul 7 14:17:06 PDT 2004
On Tue, 2004-07-06 at 14:41, Chris Friesen wrote:
> Steven Dake wrote:
> > I committed this patch. I agree the activate poll design is not
> > pretty. It is possible this can be done with two fd's in a pipe as
> > well, that that consumes alot more resources.
> A couple more fds isn't really a big deal. The annoying bit is getting the app
> to monitor the rx one for you, and notifying you when it's readable.
> > In one case the activate poll is needed by AMF in the current design, to
> > dispatch async messages on the same fd as sync messages are being
> > delivered to.
> I just had a thought. What about having the library open a link to the exec
> using a stream socket (the way it happens now), but don't actually use it for
> anything other than application death detection?
This is an interesting idea, but problematic for security reasons.
Currently an API connection is authenticated using kernel IPC
mechanisms. Once the fd is authenticated, it is used to reference
information about that particular connection (in the connection array in
the executive). This is used all over the place in the executive
currently to store state; ie: keep track of things like tracks,
iterators, components registered to a particular fd, and on and on. One
option is to pass a "reference identifier" and dereference that on every
message, but then anyone could violate security of a different process
by guessing reference identifiers.
I am also in the process of cleaning up the connection array (if you
have a look and feel sick looking at that part of the code:) so it is
passed to each executive message (instead of a big global). Now it can
be stored as part of the poll data.
> We could do all the real messaging over a datagram socket, and give *that* fd to
> the app to monitor.
> That would give the following characteristics:
> --we still get notified if either end of the stream dies
> --the library is able to send messages directly to itself
> --the app only monitors one fd per library component
> --we use one extra fd per app, which is minimal
More information about the Openais