BMessage: Fix precedence of KMessage vs. size check.

A KMessage request always needs to be honoured, regardless of the data
size.

KMessage does not currently protect against messages that are too large,
but this needs to be solved in KMessage when it becomes a problem.
This commit is contained in:
Michael Lotz 2015-08-29 11:00:39 +02:00
parent bc5a7a3749
commit c0c883cf8e

View File

@ -2132,6 +2132,13 @@ BMessage::_SendMessage(port_id port, team_id portOwner, int32 token,
return B_NO_MEMORY; return B_NO_MEMORY;
} }
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST #ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
} else if ((fHeader->flags & MESSAGE_FLAG_REPLY_AS_KMESSAGE) != 0) {
KMessage toMessage;
result = BPrivate::MessageAdapter::ConvertToKMessage(this, toMessage);
if (result != B_OK)
return result;
return toMessage.SendTo(port, token);
} else if (fHeader->data_size > B_PAGE_SIZE * 10) { } else if (fHeader->data_size > B_PAGE_SIZE * 10) {
// ToDo: bind the above size to the max port message size // ToDo: bind the above size to the max port message size
// use message passing by area for such a large message // use message passing by area for such a large message
@ -2166,13 +2173,6 @@ BMessage::_SendMessage(port_id port, team_id portOwner, int32 token,
header->message_area = transfered; header->message_area = transfered;
} }
#endif #endif
} else if ((fHeader->flags & MESSAGE_FLAG_REPLY_AS_KMESSAGE) != 0) {
KMessage toMessage;
result = BPrivate::MessageAdapter::ConvertToKMessage(this, toMessage);
if (result != B_OK)
return result;
return toMessage.SendTo(port, token);
} else { } else {
size = FlattenedSize(); size = FlattenedSize();
buffer = (char*)malloc(size); buffer = (char*)malloc(size);