Commit aa3f39bf authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

the original code uses 4-spaces tab.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39555 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7e497097
# -*- coding: utf-8 -*-
# Code based on python-memcached-1.45
try:
import memcache
import memcache
except ImportError:
pass
pass
else:
memcache._Host._SOCKET_TIMEOUT = 10 # wait more than 3s is safe
# always return string
# https://bugs.launchpad.net/python-memcached/+bug/509712
def readline(self):
buf = self.buffer
recv = self.socket.recv
while True:
index = buf.find('\r\n')
if index >= 0:
break
data = recv(4096)
if not data:
self.mark_dead('Connection closed while reading from %s'
% repr(self))
self.buffer = ''
return '' #None
buf += data
self.buffer = buf[index+2:]
return buf[:index]
memcache._Host.readline = readline
memcache._Host._SOCKET_TIMEOUT = 10 # wait more than 3s is safe
# always return string
# https://bugs.launchpad.net/python-memcached/+bug/509712
def readline(self):
buf = self.buffer
recv = self.socket.recv
while True:
index = buf.find('\r\n')
if index >= 0:
break
data = recv(4096)
if not data:
self.mark_dead('Connection closed while reading from %s'
% repr(self))
self.buffer = ''
return '' #None
buf += data
self.buffer = buf[index+2:]
return buf[:index]
memcache._Host.readline = readline
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment