Fixed some obvious bugs: B_GET_PROPERTY shouldn't enter the debugger fow unknown

properties; it should pass on to the next handler (and only if there is none
reply with a B_MESSAGE_NOT_UNDERSTOOD).
Those B_MESSAGE_NOT_UNDERSTOOD are no longer the answer to a B_MESSAGE_NOT_UNDERSTOOD
message anymore, as this lead to an endless loop (for example when starting the
media_server).
Added some ToDo comments - someone please check what has to be done and fill it
out some more.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11950 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-03-22 02:42:19 +00:00
parent 0efd929e4d
commit dfb8cfea3f
+23 -18
View File
@@ -274,6 +274,8 @@ BHandler::MessageReceived(BMessage *message)
BMessage reply(B_REPLY); BMessage reply(B_REPLY);
switch (message->what) { switch (message->what) {
// ToDo: am I missing something or is the "observed" stuff handshake completely missing?
case B_GET_PROPERTY: case B_GET_PROPERTY:
{ {
int32 cur; int32 cur;
@@ -283,22 +285,24 @@ BHandler::MessageReceived(BMessage *message)
status_t err = message->GetCurrentSpecifier(&cur, &specifier, &form, &prop); status_t err = message->GetCurrentSpecifier(&cur, &specifier, &form, &prop);
if (err == B_OK) { if (err == B_OK) {
bool known = false;
if (strcmp(prop, "Suites") == 0) { if (strcmp(prop, "Suites") == 0) {
if (GetSupportedSuites(&reply) == B_OK err = GetSupportedSuites(&reply);
&& reply.AddInt32("error", B_OK) == B_OK) known = true;
message->SendReply(&reply);
} else if (strcmp(prop, "Messenger") == 0) { } else if (strcmp(prop, "Messenger") == 0) {
if (reply.AddMessenger("result", this) == B_OK err = reply.AddMessenger("result", this);
&& reply.AddInt32("error", B_OK) == B_OK) known = true;
message->SendReply(&reply);
} else if (strcmp(prop, "InternalName") == 0) { } else if (strcmp(prop, "InternalName") == 0) {
if (reply.AddString("result", Name()) == B_OK err = reply.AddString("result", Name());
&& reply.AddInt32("error", B_OK) == B_OK) known = true;
message->SendReply(&reply);
} else {
// Should never be here
debugger("BHandler::MessageReceived(): We are *not* supposed to be here");
} }
if (known) {
reply.AddInt32("error", B_OK);
message->SendReply(&reply);
return;
}
// let's try next handler
} }
break; break;
} }
@@ -307,19 +311,20 @@ BHandler::MessageReceived(BMessage *message)
{ {
reply.AddInt32("error", GetSupportedSuites(&reply)); reply.AddInt32("error", GetSupportedSuites(&reply));
message->SendReply(&reply); message->SendReply(&reply);
break; return;
}
} }
default: // ToDo: there is some more work need here (someone in the know should fill in)!
if (fNextHandler)
if (fNextHandler) {
// aren't filters done per handler?
fNextHandler->MessageReceived(message); fNextHandler->MessageReceived(message);
else { } else if (message->what != B_MESSAGE_NOT_UNDERSTOOD) {
printf("BHandler::MessageReceived(): B_MESSAGE_NOT_UNDERSTOOD"); printf("BHandler::MessageReceived(): B_MESSAGE_NOT_UNDERSTOOD");
message->PrintToStream(); message->PrintToStream();
message->SendReply(B_MESSAGE_NOT_UNDERSTOOD); message->SendReply(B_MESSAGE_NOT_UNDERSTOOD);
} }
break;
}
} }