mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
clean socket shutdown (fix multiprocessing)
This commit is contained in:
parent
3794aa7ac7
commit
0cfda684ce
|
@ -267,6 +267,7 @@ class HttpCli(object):
|
||||||
|
|
||||||
self.log(response)
|
self.log(response)
|
||||||
self.reply(response.encode("utf-8"), headers=["Content-Type: application/json"])
|
self.reply(response.encode("utf-8"), headers=["Content-Type: application/json"])
|
||||||
|
return True
|
||||||
|
|
||||||
def handle_post_binary(self):
|
def handle_post_binary(self):
|
||||||
try:
|
try:
|
||||||
|
@ -306,7 +307,7 @@ class HttpCli(object):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
if len(cstart) > 1:
|
if len(cstart) > 1 and path != os.devnull:
|
||||||
self.log(
|
self.log(
|
||||||
"clone {} to {}".format(
|
"clone {} to {}".format(
|
||||||
cstart[0], " & ".join(str(x) for x in cstart[1:])
|
cstart[0], " & ".join(str(x) for x in cstart[1:])
|
||||||
|
|
|
@ -3,6 +3,7 @@ from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import socket
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from .__init__ import E
|
from .__init__ import E
|
||||||
|
@ -68,6 +69,7 @@ class HttpSrv(object):
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
self.log(str(addr), "-" * 7 + "C-done")
|
self.log(str(addr), "-" * 7 + "C-done")
|
||||||
|
sck.shutdown(socket.SHUT_RDWR)
|
||||||
sck.close()
|
sck.close()
|
||||||
with self.mutex:
|
with self.mutex:
|
||||||
del self.clients[cli]
|
del self.clients[cli]
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
<h1>you can browse these:</h1>
|
<h1>you can browse these:</h1>
|
||||||
<ul>
|
<ul>
|
||||||
{% for mp in this.rvol %}
|
{% for mp in this.rvol %}
|
||||||
<li><a href="/{{ mp }}">/{{ mp }}</a></li>
|
<li><a href="/{{ mp }}/">/{{ mp }}/</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h1>you can upload to:</h1>
|
<h1>you can upload to:</h1>
|
||||||
<ul>
|
<ul>
|
||||||
{% for mp in this.wvol %}
|
{% for mp in this.wvol %}
|
||||||
<li><a href="/{{ mp }}">/{{ mp }}</a></li>
|
<li><a href="/{{ mp }}/">/{{ mp }}/</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -57,4 +57,7 @@ htop -d 2 -p $(ps ax | awk '/electron[ ]/ {printf "%s%s", v, $1;v=","}')
|
||||||
renice 20 -p $$
|
renice 20 -p $$
|
||||||
|
|
||||||
# cleanup after a busted shutdown
|
# cleanup after a busted shutdown
|
||||||
ps ax | awk '/python[23]? -m copyparty/ {print $1}' | tee /dev/stderr | xargs kill
|
ps ax | awk '/python[23]? -m copyparty|python[ ]-c from multiproc/ {print $1}' | tee /dev/stderr | xargs kill
|
||||||
|
|
||||||
|
# last line of each function in a file
|
||||||
|
cat copyparty/httpcli.py | awk '/^[^a-zA-Z0-9]+def / {printf "%s\n%s\n\n", f, pl; f=$2} /[a-zA-Z0-9]/ {pl=$0}'
|
||||||
|
|
Loading…
Reference in a new issue