aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llplugin
diff options
context:
space:
mode:
authorMcCabe Maxsted2011-02-18 19:44:16 -0700
committerMcCabe Maxsted2011-02-18 19:44:16 -0700
commitf6c52845fa2509f420e599b4c2033dfa1571f1ed (patch)
tree281bf361a3fdd22665c571b3eee417d340c77c9f /linden/indra/llplugin
parentCreated a media_plugin_gstreamer010.log file in the cwd for the GStreamer plugin (diff)
parentFixed Windows compile error introduced in fe9a3d2b. Also made sure winsock2.h... (diff)
downloadmeta-impy-f6c52845fa2509f420e599b4c2033dfa1571f1ed.zip
meta-impy-f6c52845fa2509f420e599b4c2033dfa1571f1ed.tar.gz
meta-impy-f6c52845fa2509f420e599b4c2033dfa1571f1ed.tar.bz2
meta-impy-f6c52845fa2509f420e599b4c2033dfa1571f1ed.tar.xz
Merge remote branch 'remotes/github/weekly' into weekly
Diffstat (limited to 'linden/indra/llplugin')
-rwxr-xr-xlinden/indra/llplugin/llplugininstance.cpp5
-rwxr-xr-xlinden/indra/llplugin/llpluginmessagepipe.cpp2
-rwxr-xr-xlinden/indra/llplugin/llpluginprocesschild.cpp2
-rwxr-xr-xlinden/indra/llplugin/llpluginprocessparent.cpp55
-rwxr-xr-xlinden/indra/llplugin/llpluginprocessparent.h2
-rwxr-xr-xlinden/indra/llplugin/llpluginsharedmemory.cpp11
-rwxr-xr-xlinden/indra/llplugin/llpluginsharedmemory.h3
-rwxr-xr-xlinden/indra/llplugin/slplugin/slplugin.cpp6
8 files changed, 40 insertions, 46 deletions
diff --git a/linden/indra/llplugin/llplugininstance.cpp b/linden/indra/llplugin/llplugininstance.cpp
index fd1c3c1..67457f2 100755
--- a/linden/indra/llplugin/llplugininstance.cpp
+++ b/linden/indra/llplugin/llplugininstance.cpp
@@ -36,8 +36,7 @@
36#include "linden_common.h" 36#include "linden_common.h"
37 37
38#include "llplugininstance.h" 38#include "llplugininstance.h"
39 39#include "aiaprpool.h"
40#include "llapr.h"
41 40
42/** Virtual destructor. */ 41/** Virtual destructor. */
43LLPluginInstanceMessageListener::~LLPluginInstanceMessageListener() 42LLPluginInstanceMessageListener::~LLPluginInstanceMessageListener()
@@ -86,7 +85,7 @@ int LLPluginInstance::load(std::string &plugin_file)
86 85
87 int result = apr_dso_load(&mDSOHandle, 86 int result = apr_dso_load(&mDSOHandle,
88 plugin_file.c_str(), 87 plugin_file.c_str(),
89 gAPRPoolp); 88 AIAPRRootPool::get()());
90 if(result != APR_SUCCESS) 89 if(result != APR_SUCCESS)
91 { 90 {
92 char buf[1024]; 91 char buf[1024];
diff --git a/linden/indra/llplugin/llpluginmessagepipe.cpp b/linden/indra/llplugin/llpluginmessagepipe.cpp
index 26cc9c0..ac3a902 100755
--- a/linden/indra/llplugin/llpluginmessagepipe.cpp
+++ b/linden/indra/llplugin/llpluginmessagepipe.cpp
@@ -99,8 +99,6 @@ void LLPluginMessagePipeOwner::killMessagePipe(void)
99} 99}
100 100
101LLPluginMessagePipe::LLPluginMessagePipe(LLPluginMessagePipeOwner *owner, LLSocket::ptr_t socket): 101LLPluginMessagePipe::LLPluginMessagePipe(LLPluginMessagePipeOwner *owner, LLSocket::ptr_t socket):
102 mInputMutex(gAPRPoolp),
103 mOutputMutex(gAPRPoolp),
104 mOwner(owner), 102 mOwner(owner),
105 mSocket(socket) 103 mSocket(socket)
106{ 104{
diff --git a/linden/indra/llplugin/llpluginprocesschild.cpp b/linden/indra/llplugin/llpluginprocesschild.cpp
index c8b97b1..a1291c0 100755
--- a/linden/indra/llplugin/llpluginprocesschild.cpp
+++ b/linden/indra/llplugin/llpluginprocesschild.cpp
@@ -47,7 +47,7 @@ LLPluginProcessChild::LLPluginProcessChild()
47{ 47{
48 mState = STATE_UNINITIALIZED; 48 mState = STATE_UNINITIALIZED;
49 mInstance = NULL; 49 mInstance = NULL;
50 mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP); 50 mSocket = LLSocket::create(LLSocket::STREAM_TCP);
51 mSleepTime = PLUGIN_IDLE_SECONDS; // default: send idle messages at 100Hz 51 mSleepTime = PLUGIN_IDLE_SECONDS; // default: send idle messages at 100Hz
52 mCPUElapsed = 0.0f; 52 mCPUElapsed = 0.0f;
53 mBlockingRequest = false; 53 mBlockingRequest = false;
diff --git a/linden/indra/llplugin/llpluginprocessparent.cpp b/linden/indra/llplugin/llpluginprocessparent.cpp
index ecb2262..5a66279 100755
--- a/linden/indra/llplugin/llpluginprocessparent.cpp
+++ b/linden/indra/llplugin/llpluginprocessparent.cpp
@@ -49,6 +49,7 @@ LLPluginProcessParentOwner::~LLPluginProcessParentOwner()
49 49
50bool LLPluginProcessParent::sUseReadThread = false; 50bool LLPluginProcessParent::sUseReadThread = false;
51apr_pollset_t *LLPluginProcessParent::sPollSet = NULL; 51apr_pollset_t *LLPluginProcessParent::sPollSet = NULL;
52AIAPRPool LLPluginProcessParent::sPollSetPool;
52bool LLPluginProcessParent::sPollsetNeedsRebuild = false; 53bool LLPluginProcessParent::sPollsetNeedsRebuild = false;
53LLMutex *LLPluginProcessParent::sInstancesMutex; 54LLMutex *LLPluginProcessParent::sInstancesMutex;
54std::list<LLPluginProcessParent*> LLPluginProcessParent::sInstances; 55std::list<LLPluginProcessParent*> LLPluginProcessParent::sInstances;
@@ -59,7 +60,7 @@ class LLPluginProcessParentPollThread: public LLThread
59{ 60{
60public: 61public:
61 LLPluginProcessParentPollThread() : 62 LLPluginProcessParentPollThread() :
62 LLThread("LLPluginProcessParentPollThread", gAPRPoolp) 63 LLThread("LLPluginProcessParentPollThread")
63 { 64 {
64 } 65 }
65protected: 66protected:
@@ -84,12 +85,11 @@ protected:
84 85
85}; 86};
86 87
87LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner): 88LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner)
88 mIncomingQueueMutex(gAPRPoolp)
89{ 89{
90 if(!sInstancesMutex) 90 if(!sInstancesMutex)
91 { 91 {
92 sInstancesMutex = new LLMutex(gAPRPoolp); 92 sInstancesMutex = new LLMutex;
93 } 93 }
94 94
95 mOwner = owner; 95 mOwner = owner;
@@ -102,6 +102,7 @@ LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner):
102 mBlocked = false; 102 mBlocked = false;
103 mPolledInput = false; 103 mPolledInput = false;
104 mPollFD.client_data = NULL; 104 mPollFD.client_data = NULL;
105 mPollFDPool.create();
105 106
106 mPluginLaunchTimeout = 60.0f; 107 mPluginLaunchTimeout = 60.0f;
107 mPluginLockupTimeout = 15.0f; 108 mPluginLockupTimeout = 15.0f;
@@ -177,44 +178,28 @@ void LLPluginProcessParent::init(const std::string &launcher_filename, const std
177bool LLPluginProcessParent::accept() 178bool LLPluginProcessParent::accept()
178{ 179{
179 bool result = false; 180 bool result = false;
180
181 apr_status_t status = APR_EGENERAL; 181 apr_status_t status = APR_EGENERAL;
182 apr_socket_t *new_socket = NULL;
183
184 status = apr_socket_accept(
185 &new_socket,
186 mListenSocket->getSocket(),
187 gAPRPoolp);
188 182
183 mSocket = LLSocket::create(status, mListenSocket);
189 184
190 if(status == APR_SUCCESS) 185 if(status == APR_SUCCESS)
191 { 186 {
192// llinfos << "SUCCESS" << llendl; 187// llinfos << "SUCCESS" << llendl;
193 // Success. Create a message pipe on the new socket 188 // Success. Create a message pipe on the new socket
194
195 // we MUST create a new pool for the LLSocket, since it will take ownership of it and delete it in its destructor!
196 apr_pool_t* new_pool = NULL;
197 status = apr_pool_create(&new_pool, gAPRPoolp);
198
199 mSocket = LLSocket::create(new_socket, new_pool);
200 new LLPluginMessagePipe(this, mSocket); 189 new LLPluginMessagePipe(this, mSocket);
201 190
202 result = true; 191 result = true;
203 } 192 }
204 else if(APR_STATUS_IS_EAGAIN(status))
205 {
206// llinfos << "EAGAIN" << llendl;
207
208 // No incoming connections. This is not an error.
209 status = APR_SUCCESS;
210 }
211 else 193 else
212 { 194 {
213// llinfos << "Error:" << llendl; 195 mSocket.reset();
214 ll_apr_warn_status(status); 196 // EAGAIN means "No incoming connections". This is not an error.
215 197 if (!APR_STATUS_IS_EAGAIN(status))
216 // Some other error. 198 {
217 errorState(); 199 // Some other error.
200 ll_apr_warn_status(status);
201 errorState();
202 }
218 } 203 }
219 204
220 return result; 205 return result;
@@ -283,7 +268,7 @@ void LLPluginProcessParent::idle(void)
283 268
284 apr_status_t status = APR_SUCCESS; 269 apr_status_t status = APR_SUCCESS;
285 apr_sockaddr_t* addr = NULL; 270 apr_sockaddr_t* addr = NULL;
286 mListenSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP); 271 mListenSocket = LLSocket::create(LLSocket::STREAM_TCP);
287 mBoundPort = 0; 272 mBoundPort = 0;
288 273
289 // This code is based on parts of LLSocket::create() in lliosocket.cpp. 274 // This code is based on parts of LLSocket::create() in lliosocket.cpp.
@@ -294,7 +279,7 @@ void LLPluginProcessParent::idle(void)
294 APR_INET, 279 APR_INET,
295 0, // port 0 = ephemeral ("find me a port") 280 0, // port 0 = ephemeral ("find me a port")
296 0, 281 0,
297 gAPRPoolp); 282 AIAPRRootPool::get()());
298 283
299 if(ll_apr_warn_status(status)) 284 if(ll_apr_warn_status(status))
300 { 285 {
@@ -617,7 +602,8 @@ void LLPluginProcessParent::setMessagePipe(LLPluginMessagePipe *message_pipe)
617 if(message_pipe != NULL) 602 if(message_pipe != NULL)
618 { 603 {
619 // Set up the apr_pollfd_t 604 // Set up the apr_pollfd_t
620 mPollFD.p = gAPRPoolp; 605
606 mPollFD.p = mPollFDPool();
621 mPollFD.desc_type = APR_POLL_SOCKET; 607 mPollFD.desc_type = APR_POLL_SOCKET;
622 mPollFD.reqevents = APR_POLLIN|APR_POLLERR|APR_POLLHUP; 608 mPollFD.reqevents = APR_POLLIN|APR_POLLERR|APR_POLLHUP;
623 mPollFD.rtnevents = 0; 609 mPollFD.rtnevents = 0;
@@ -664,6 +650,7 @@ void LLPluginProcessParent::updatePollset()
664 // delete the existing pollset. 650 // delete the existing pollset.
665 apr_pollset_destroy(sPollSet); 651 apr_pollset_destroy(sPollSet);
666 sPollSet = NULL; 652 sPollSet = NULL;
653 sPollSetPool.destroy();
667 } 654 }
668 655
669 std::list<LLPluginProcessParent*>::iterator iter; 656 std::list<LLPluginProcessParent*>::iterator iter;
@@ -686,12 +673,14 @@ void LLPluginProcessParent::updatePollset()
686 { 673 {
687#ifdef APR_POLLSET_NOCOPY 674#ifdef APR_POLLSET_NOCOPY
688 // The pollset doesn't exist yet. Create it now. 675 // The pollset doesn't exist yet. Create it now.
689 apr_status_t status = apr_pollset_create(&sPollSet, count, gAPRPoolp, APR_POLLSET_NOCOPY); 676 sPollSetPool.create();
677 apr_status_t status = apr_pollset_create(&sPollSet, count, sPollSetPool(), APR_POLLSET_NOCOPY);
690 if(status != APR_SUCCESS) 678 if(status != APR_SUCCESS)
691 { 679 {
692#endif // APR_POLLSET_NOCOPY 680#endif // APR_POLLSET_NOCOPY
693 LL_WARNS("PluginPoll") << "Couldn't create pollset. Falling back to non-pollset mode." << LL_ENDL; 681 LL_WARNS("PluginPoll") << "Couldn't create pollset. Falling back to non-pollset mode." << LL_ENDL;
694 sPollSet = NULL; 682 sPollSet = NULL;
683 sPollSetPool.destroy();
695#ifdef APR_POLLSET_NOCOPY 684#ifdef APR_POLLSET_NOCOPY
696 } 685 }
697 else 686 else
diff --git a/linden/indra/llplugin/llpluginprocessparent.h b/linden/indra/llplugin/llpluginprocessparent.h
index 95f5f70..bba3643 100755
--- a/linden/indra/llplugin/llpluginprocessparent.h
+++ b/linden/indra/llplugin/llpluginprocessparent.h
@@ -186,7 +186,9 @@ private:
186 186
187 static bool sUseReadThread; 187 static bool sUseReadThread;
188 apr_pollfd_t mPollFD; 188 apr_pollfd_t mPollFD;
189 AIAPRPool mPollFDPool;
189 static apr_pollset_t *sPollSet; 190 static apr_pollset_t *sPollSet;
191 static AIAPRPool sPollSetPool;
190 static bool sPollsetNeedsRebuild; 192 static bool sPollsetNeedsRebuild;
191 static LLMutex *sInstancesMutex; 193 static LLMutex *sInstancesMutex;
192 static std::list<LLPluginProcessParent*> sInstances; 194 static std::list<LLPluginProcessParent*> sInstances;
diff --git a/linden/indra/llplugin/llpluginsharedmemory.cpp b/linden/indra/llplugin/llpluginsharedmemory.cpp
index e8a411a..6becb8d 100755
--- a/linden/indra/llplugin/llpluginsharedmemory.cpp
+++ b/linden/indra/llplugin/llpluginsharedmemory.cpp
@@ -84,6 +84,8 @@
84 #include <sys/mman.h> 84 #include <sys/mman.h>
85 #include <errno.h> 85 #include <errno.h>
86#elif USE_WIN32_SHARED_MEMORY 86#elif USE_WIN32_SHARED_MEMORY
87# define WIN32_LEAN_AND_MEAN
88# include <winsock2.h>
87#include <windows.h> 89#include <windows.h>
88#endif // USE_APR_SHARED_MEMORY 90#endif // USE_APR_SHARED_MEMORY
89 91
@@ -201,7 +203,8 @@ bool LLPluginSharedMemory::create(size_t size)
201 mName += createName(); 203 mName += createName();
202 mSize = size; 204 mSize = size;
203 205
204 apr_status_t status = apr_shm_create( &(mImpl->mAprSharedMemory), mSize, mName.c_str(), gAPRPoolp ); 206 mPool.create();
207 apr_status_t status = apr_shm_create( &(mImpl->mAprSharedMemory), mSize, mName.c_str(), mPool());
205 208
206 if(ll_apr_warn_status(status)) 209 if(ll_apr_warn_status(status))
207 { 210 {
@@ -224,7 +227,7 @@ bool LLPluginSharedMemory::destroy(void)
224 } 227 }
225 mImpl->mAprSharedMemory = NULL; 228 mImpl->mAprSharedMemory = NULL;
226 } 229 }
227 230 mPool.destroy();
228 return true; 231 return true;
229} 232}
230 233
@@ -233,7 +236,8 @@ bool LLPluginSharedMemory::attach(const std::string &name, size_t size)
233 mName = name; 236 mName = name;
234 mSize = size; 237 mSize = size;
235 238
236 apr_status_t status = apr_shm_attach( &(mImpl->mAprSharedMemory), mName.c_str(), gAPRPoolp ); 239 mPool.create();
240 apr_status_t status = apr_shm_attach( &(mImpl->mAprSharedMemory), mName.c_str(), mPool() );
237 241
238 if(ll_apr_warn_status(status)) 242 if(ll_apr_warn_status(status))
239 { 243 {
@@ -255,6 +259,7 @@ bool LLPluginSharedMemory::detach(void)
255 } 259 }
256 mImpl->mAprSharedMemory = NULL; 260 mImpl->mAprSharedMemory = NULL;
257 } 261 }
262 mPool.destroy();
258 263
259 return true; 264 return true;
260} 265}
diff --git a/linden/indra/llplugin/llpluginsharedmemory.h b/linden/indra/llplugin/llpluginsharedmemory.h
index 081d311..669a3e4 100755
--- a/linden/indra/llplugin/llpluginsharedmemory.h
+++ b/linden/indra/llplugin/llpluginsharedmemory.h
@@ -35,6 +35,8 @@
35#ifndef LL_LLPLUGINSHAREDMEMORY_H 35#ifndef LL_LLPLUGINSHAREDMEMORY_H
36#define LL_LLPLUGINSHAREDMEMORY_H 36#define LL_LLPLUGINSHAREDMEMORY_H
37 37
38#include "aiaprpool.h"
39
38class LLPluginSharedMemoryPlatformImpl; 40class LLPluginSharedMemoryPlatformImpl;
39 41
40/** 42/**
@@ -115,6 +117,7 @@ private:
115 bool close(void); 117 bool close(void);
116 bool unlink(void); 118 bool unlink(void);
117 119
120 AIAPRPool mPool;
118 std::string mName; 121 std::string mName;
119 size_t mSize; 122 size_t mSize;
120 void *mMappedAddress; 123 void *mMappedAddress;
diff --git a/linden/indra/llplugin/slplugin/slplugin.cpp b/linden/indra/llplugin/slplugin/slplugin.cpp
index 64c087b..878577b 100755
--- a/linden/indra/llplugin/slplugin/slplugin.cpp
+++ b/linden/indra/llplugin/slplugin/slplugin.cpp
@@ -78,6 +78,8 @@ static void crash_handler(int sig)
78#endif 78#endif
79 79
80#if LL_WINDOWS 80#if LL_WINDOWS
81# define WIN32_LEAN_AND_MEAN
82# include <winsock2.h>
81#include <windows.h> 83#include <windows.h>
82//////////////////////////////////////////////////////////////////////////////// 84////////////////////////////////////////////////////////////////////////////////
83// Our exception handler - will probably just exit and the host application 85// Our exception handler - will probably just exit and the host application
@@ -183,8 +185,6 @@ int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
183int main(int argc, char **argv) 185int main(int argc, char **argv)
184#endif 186#endif
185{ 187{
186 ll_init_apr();
187
188 // Set up llerror logging 188 // Set up llerror logging
189 { 189 {
190 LLError::initForApplication("."); 190 LLError::initForApplication(".");
@@ -400,8 +400,6 @@ int main(int argc, char **argv)
400 400
401 delete plugin; 401 delete plugin;
402 402
403 ll_cleanup_apr();
404
405 return 0; 403 return 0;
406} 404}
407 405