On 2008/11/14 11:41, Marc Pavot <[EMAIL PROTECTED]> wrote:
> The two sockets solution is easy to implement and interesting but as Max
> sayed it soncumes precious ressources.
> We may have another solution (used for example by XMMS2):
> - Each query has an identifier
> - Each reply has the identifier corresponding to the query
> - Each subscription to an event notification also has an identifier
> - Each notification has the identifier corresponding to the subscription
> 
> This means some important changes in MPD protocol but it has several
> advantages:
> - It uses only one socket

No difference to "idle".

> - It is easy to implement on client side (you just have to keep a list of
> identifier to understand what you receive)

I would call that idea "much more complicated", because:

- you have to generate these identifiers
- you have to remember them
- you have to parse them
- you must always be prepared to receive an event, even when you're
  expecting a response to another command; don't underestimate the
  complexity attached to that!

"idle", in contrast, lets the client decide when it's ready to check
for events, i.e. always start "idle" before returning control to the
main loop (libevent, select(), poll()), and don't care about events
while you're busy with something.

> - It enables you to implement synchronous and asynchronous calls to MPD on
> client side which is not an easy thing with current protocol.

Right, pipelined commands could be reordered by the server.  That's
indeed an advantage, but would require a lot of additional complexity
on the server side.  Since commands shouldn't be blocking (except
"idle"), I don't think it's worth it.

> - It will be easy to implement a publish-subscribe solution for
> event notifications

MPD has that already...

Max

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to