Cleanup of previous work: whether or not we're talking to app_server is already determined at time of port assignment. As such we don't need to cache or care about that, but rather just cache the target team instead of looking it up from the port info every time.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35682 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2010-02-28 23:25:23 +00:00
parent 099f9551c7
commit 4f85bc9f18
2 changed files with 9 additions and 19 deletions

View File

@ -45,7 +45,7 @@ class LinkSender {
status_t FlushCompleted(size_t newBufferSize);
port_id fPort;
port_id fAppServerPort;
team_id fTargetTeam;
char *fBuffer;
size_t fBufferSize;

View File

@ -14,8 +14,6 @@
#include <string.h>
#include <new>
#include <Application.h>
#include <AppMisc.h>
#include <ServerProtocol.h>
#include <LinkSender.h>
@ -39,7 +37,7 @@ namespace BPrivate {
LinkSender::LinkSender(port_id port)
:
fPort(port),
fAppServerPort(-1),
fTargetTeam(-1),
fBuffer(NULL),
fBufferSize(0),
@ -164,21 +162,13 @@ LinkSender::Attach(const void *passedData, size_t passedSize)
area_id senderArea = -1;
if (useArea) {
team_id target = -1;
port_id port = -1;
if (be_app == NULL)
port = fPort;
else {
if (fAppServerPort < 0)
fAppServerPort = get_app_server_port();
port = fAppServerPort;
if (fTargetTeam < 0) {
port_info info;
status_t result = get_port_info(fPort, &info);
if (result != B_OK)
return result;
fTargetTeam = info.team;
}
port_info info;
status_t result = get_port_info(port, &info);
if (result != B_OK)
return result;
target = info.team;
void* address = NULL;
off_t alignedSize = (passedSize + B_PAGE_SIZE) & ~(B_PAGE_SIZE - 1);
senderArea = create_area("LinkSenderArea", &address, B_ANY_ADDRESS,
@ -192,7 +182,7 @@ LinkSender::Attach(const void *passedData, size_t passedSize)
area_id areaID = senderArea;
senderArea = _kern_transfer_area(senderArea, &address,
B_ANY_ADDRESS, target);
B_ANY_ADDRESS, fTargetTeam);
if (senderArea < B_OK) {
delete_area(areaID);