From 099f9551c781dcc312acb7eb2231f1d46b4b9048 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 28 Feb 2010 22:55:43 +0000 Subject: [PATCH] Cache the app_server port lazily so we don't have to look it up every time. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35681 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/app/LinkSender.h | 1 + src/kits/app/LinkSender.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/headers/private/app/LinkSender.h b/headers/private/app/LinkSender.h index 775694af15..48886ac6c3 100644 --- a/headers/private/app/LinkSender.h +++ b/headers/private/app/LinkSender.h @@ -45,6 +45,7 @@ class LinkSender { status_t FlushCompleted(size_t newBufferSize); port_id fPort; + port_id fAppServerPort; char *fBuffer; size_t fBufferSize; diff --git a/src/kits/app/LinkSender.cpp b/src/kits/app/LinkSender.cpp index 182d840f84..c8bfb5458a 100644 --- a/src/kits/app/LinkSender.cpp +++ b/src/kits/app/LinkSender.cpp @@ -39,6 +39,7 @@ namespace BPrivate { LinkSender::LinkSender(port_id port) : fPort(port), + fAppServerPort(-1), fBuffer(NULL), fBufferSize(0), @@ -167,9 +168,11 @@ LinkSender::Attach(const void *passedData, size_t passedSize) port_id port = -1; if (be_app == NULL) port = fPort; - else - port = get_app_server_port(); - + else { + if (fAppServerPort < 0) + fAppServerPort = get_app_server_port(); + port = fAppServerPort; + } port_info info; status_t result = get_port_info(port, &info); if (result != B_OK)