forked from indymedia/epicyon
More debug
parent
e311d61a6e
commit
b5bcb75c3c
65
daemon.py
65
daemon.py
|
@ -2636,42 +2636,45 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
This creates a thread to send the new post
|
This creates a thread to send the new post
|
||||||
"""
|
"""
|
||||||
pageNumber=1
|
pageNumber=1
|
||||||
if authorized and '/users/' in path and '?'+postType+'?' in path:
|
if not (authorized and '/users/' in path and '?'+postType+'?' in path):
|
||||||
if '?page=' in path:
|
print('Not receiving new post for '+path)
|
||||||
pageNumberStr=path.split('?page=')[1]
|
return None
|
||||||
if '?' in pageNumberStr:
|
|
||||||
pageNumberStr=pageNumberStr.split('?')[0]
|
|
||||||
if pageNumberStr.isdigit():
|
|
||||||
pageNumber=int(pageNumberStr)
|
|
||||||
path=path.split('?page=')[0]
|
|
||||||
|
|
||||||
newPostThreadName=self.postToNickname
|
if '?page=' in path:
|
||||||
if not newPostThreadName:
|
pageNumberStr=path.split('?page=')[1]
|
||||||
newPostThreadName='*'
|
if '?' in pageNumberStr:
|
||||||
|
pageNumberStr=pageNumberStr.split('?')[0]
|
||||||
|
if pageNumberStr.isdigit():
|
||||||
|
pageNumber=int(pageNumberStr)
|
||||||
|
path=path.split('?page=')[0]
|
||||||
|
|
||||||
|
newPostThreadName=self.postToNickname
|
||||||
|
if not newPostThreadName:
|
||||||
|
newPostThreadName='*'
|
||||||
|
|
||||||
if self.server.newPostThread.get(newPostThreadName):
|
if self.server.newPostThread.get(newPostThreadName):
|
||||||
print('Waiting for previous new post thread to end')
|
print('Waiting for previous new post thread to end')
|
||||||
waitCtr=0
|
waitCtr=0
|
||||||
while self.server.newPostThread[newPostThreadName].isAlive() and waitCtr<8:
|
while self.server.newPostThread[newPostThreadName].isAlive() and waitCtr<8:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
waitCtr+=1
|
waitCtr+=1
|
||||||
if waitCtr>=8:
|
if waitCtr>=8:
|
||||||
self.server.newPostThread[newPostThreadName].kill()
|
self.server.newPostThread[newPostThreadName].kill()
|
||||||
|
|
||||||
# make a copy of self.headers
|
# make a copy of self.headers
|
||||||
headers={}
|
headers={}
|
||||||
for dictEntryName,headerLine in self.headers.items():
|
for dictEntryName,headerLine in self.headers.items():
|
||||||
headers[dictEntryName]=headerLine
|
headers[dictEntryName]=headerLine
|
||||||
|
print('New post headers: '+str(headers))
|
||||||
|
|
||||||
print('Creating new post thread')
|
print('Creating new post thread')
|
||||||
self.server.newPostThread[newPostThreadName]= \
|
self.server.newPostThread[newPostThreadName]= \
|
||||||
threadWithTrace(target=self._receiveNewPostThread, \
|
threadWithTrace(target=self._receiveNewPostThread, \
|
||||||
args=(authorized,postType,path,headers),daemon=True)
|
args=(authorized,postType,path,headers),daemon=True)
|
||||||
|
|
||||||
print('Starting new post thread')
|
print('Starting new post thread')
|
||||||
self.server.newPostThread[newPostThreadName].start()
|
self.server.newPostThread[newPostThreadName].start()
|
||||||
return pageNumber
|
return pageNumber
|
||||||
return None
|
|
||||||
|
|
||||||
def do_POST(self):
|
def do_POST(self):
|
||||||
if not self.server.session:
|
if not self.server.session:
|
||||||
|
|
Loading…
Reference in New Issue