git://git.onelab.eu
/
plcapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2aac8ee
)
fix for WSGI-based PLCAPI, on behalf of Thomas Dreibholz
author
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Thu, 25 Jul 2013 19:07:39 +0000
(21:07 +0200)
committer
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Thu, 25 Jul 2013 19:07:39 +0000
(21:07 +0200)
apache/plc.wsgi
patch
|
blob
|
history
diff --git
a/apache/plc.wsgi
b/apache/plc.wsgi
index
e6a7eb3
..
c37d369
100644
(file)
--- a/
apache/plc.wsgi
+++ b/
apache/plc.wsgi
@@
-12,8
+12,6
@@
import traceback
from PLC.Debug import log
from PLC.API import PLCAPI
from PLC.Debug import log
from PLC.API import PLCAPI
-api = PLCAPI()
-
def application(environ, start_response):
try:
status = '200 OK'
def application(environ, start_response):
try:
status = '200 OK'
@@
-28,6
+26,12
@@
def application(environ, start_response):
</body></html>
"""
else:
</body></html>
"""
else:
+ # Thomas Dreibholz <dreibh@simula.no>
+ # Note that this function is called within multiple threads!
+ # "api" MUST be a local variable instead of a global one.
+ # Otherwise, this causes concurrent accesses to the same
+ # object within different threads!
+ api = PLCAPI()
api.environ = environ
content_type = 'text/xml'
ip = environ.get('REMOTE_ADDR')
api.environ = environ
content_type = 'text/xml'
ip = environ.get('REMOTE_ADDR')