<div class="gmail_quote"><div>2011/4/11 Kristian Høgsberg <span dir="ltr"><<a href="mailto:krh@bitplanet.net" target="_blank">krh@bitplanet.net</a>></span><br></div><div class="gmail_quote"><div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On Sun, Apr 10, 2011 at 1:47 PM, Iskren Chernev<br>
<<a href="mailto:iskren.chernev@gmail.com" target="_blank">iskren.chernev@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
> I think I can do the second point in the TODO file:<br>
><br>
> The message format has to include information about number of fds<br>
> in the message so we can skip a message correctly. Or we should<br>
> just give up on trying to recover from unknown messages. We need<br>
> to make sure you never get a message from an interface you don't<br>
> know about (using per-client id space and subscribe) or include<br>
> information on number of fds, so marshalling logic can skip.<br>
><br>
> So one solution is to include the number of fds in the serialization of the<br>
> message, maybe as a 3rd word in the header?<br>
<br>
</div>Yeah, that's the straight forward idea. I was thinking that we could<br>
be a little smarter about the encoding and use the 16 bits we<br>
currently use for siz a little differently. Make the upper bit of the<br>
size field reserved, the next three the number of fds and the<br>
remaining 12 bits the size of the message. That means we're reducing<br>
the maximum message size from 64k to 4k bytes, but that's ok, the<br>
Wayland protocol isn't intended for bulk transfer (send a pipe fd for<br>
that). The reserved bit must be zero and I'm thinking we can use it<br>
to indicate the presence of optinal header fields.<br>
<div><br></div></blockquote></div><div>Ok, that makes sense.</div><div><div></div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
> The idea about subscription also sounds reasonable, but I don't understand<br>
> what is ment by "per-client id space". After a global object is broadcasted,<br>
> the client may choose to subscribe or not, but I don't see per-client id<br>
> space here (except that the server must maintain for each client what ids is<br>
> he listening to -- maybe that is meant by "per client id space".<br>
<br>
</div>The per-client id space has a couple of benefits. It greatly<br>
simplifies the id allocation (since now the client is in charge of the<br>
entire 32 bit id space) and it means that there's no way a client can<br>
possible address other clients objects. The subscription step is when<br>
the client assigns a client id to a global object. With this step in<br>
place, we could even change the type of ids used for global objects to<br>
be something else - strings, for example. Anyway, this is something<br>
I've been working on, I've just been distracted enough to not actually<br>
finish it for the previous one or two months...<br>
<div><br>
> Also, somewhat related, how different versions of the same interface are<br>
> going to be handled. For example a client only "knows" version 2 of Foo, but<br>
> the server broadcasts version 3 of Foo at some point. So does the client<br>
> subscribe? What if Foo's messages are crucial for that client? Maybe it<br>
> should specify ver 2 in the subscription, and then the sever must make sure<br>
> not to broadcast messages that are not included in ver 2, but then ver 3<br>
> must be backward compatible I guess.<br>
><br>
> So what do you suggest?<br>
<br>
</div>Yup, that's another benefit to the subscription step. The client can<br>
specify which version of the interface it understands. The idea is<br>
that interface should always be backwards compatible, clients are<br>
expected to ignore messages introduced in newer versions.<br>
<font color="#888888"><br></font></blockquote></div></div><div>So basically, even if you implement the subscription mechanism the number of file descriptors should be given -- except in the case where the server knows all previous versions and sends only the messages the client knows of. Maybe all messages should have the version number they were introduced in.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><font color="#888888">
Kristian<br>
</font></blockquote></div><br><div><br></div><div>So I can safely implement the passing of the number of fds the way that you describe it (safely -- I mean it wont be redundant after a few months :)).</div><div><br></div>
<div>Regards,</div><div>Iskren</div>
</div><br>