This commit is contained in:
Kovid Goyal 2015-05-25 22:19:54 +05:30
parent 51b8281151
commit 38f4a2aa69
3 changed files with 4 additions and 3 deletions

View File

@ -15,13 +15,12 @@ from calibre.ptempfile import TemporaryDirectory
from calibre.srv.opts import Options
from calibre.srv.utils import (
socket_errors_socket_closed, socket_errors_nonblocking, HandleInterrupt,
socket_errors_eintr, start_cork, stop_cork)
socket_errors_eintr, start_cork, stop_cork, DESIRED_SEND_BUFFER_SIZE)
from calibre.utils.socket_inheritance import set_socket_inherit
from calibre.utils.logging import ThreadSafeLog
from calibre.utils.monotonic import monotonic
READ, WRITE, RDWR = 'READ', 'WRITE', 'RDWR'
DESIRED_SEND_BUFFER_SIZE = 16 * 1024
class Connection(object):

View File

@ -329,6 +329,7 @@ class TestHTTP(BaseTest):
self.ae(len(data), len(rdata))
self.ae(hashlib.sha1(data).hexdigest(), hashlib.sha1(rdata).hexdigest())
self.ae(data, rdata)
self.assertLess(monotonic() - start_time, 1, 'Large file transfer took too long')
time_taken = monotonic() - start_time
self.assertLess(time_taken, 1, 'Large file transfer took too long')
# }}}

View File

@ -17,6 +17,7 @@ from calibre.constants import iswindows
HTTP1 = 'HTTP/1.0'
HTTP11 = 'HTTP/1.1'
DESIRED_SEND_BUFFER_SIZE = 16 * 1024 # windows 7 uses an 8KB sndbuf
def http_date(timeval=None):
return type('')(formatdate(timeval=timeval, usegmt=True))