Commit 6a5dfc32 authored by Sidnei da Silva's avatar Sidnei da Silva

- Temporary workaround for new asyncore in Python 2.6. Need to clean this up

parent 4913d686
......@@ -45,7 +45,8 @@ from HTTPResponse import make_response
from ZPublisher.HTTPRequest import HTTPRequest
from App.config import getConfiguration
from medusa.http_server import http_server,get_header, http_channel, VERSION_STRING
from medusa.http_server import http_server, get_header
from medusa.http_server import fifo, http_channel, VERSION_STRING
import asyncore
from medusa import counter, producers
from medusa.test import max_sockets
......@@ -334,6 +335,10 @@ class zhttp_channel(http_channel):
def __init__(self, server, conn, addr):
http_channel.__init__(self, server, conn, addr)
if isinstance(self.producer_fifo, fifo):
self.producer_fifo_push = self.producer_fifo.push
else:
self.producer_fifo_push = self.producer_fifo.append
requestCloseOnExec(conn)
self.queue=[]
self.working=0
......@@ -345,7 +350,7 @@ class zhttp_channel(http_channel):
# producers by default
if self.closed:
return
self.producer_fifo.push(producer)
self.producer_fifo_push(producer)
if send: self.initiate_send()
push_with_producer=push
......
......@@ -528,25 +528,25 @@ class http_channel (asynchat.async_chat):
# no handlers, so complain
r.error (404)
def writable (self):
# this is just the normal async_chat 'writable', here for comparison
return self.ac_out_buffer or len(self.producer_fifo)
def writable_for_proxy (self):
# this version of writable supports the idea of a 'stalled' producer
# [i.e., it's not ready to produce any output yet] This is needed by
# the proxy, which will be waiting for the magic combination of
# 1) hostname resolved
# 2) connection made
# 3) data available.
if self.ac_out_buffer:
return 1
elif len(self.producer_fifo):
p = self.producer_fifo.first()
if hasattr (p, 'stalled'):
return not p.stalled()
else:
return 1
#def writable (self):
# # this is just the normal async_chat 'writable', here for comparison
# return self.ac_out_buffer or len(self.producer_fifo)
#def writable_for_proxy (self):
# # this version of writable supports the idea of a 'stalled' producer
# # [i.e., it's not ready to produce any output yet] This is needed by
# # the proxy, which will be waiting for the magic combination of
# # 1) hostname resolved
# # 2) connection made
# # 3) data available.
# if self.ac_out_buffer:
# return 1
# elif len(self.producer_fifo):
# p = self.producer_fifo.first()
# if hasattr (p, 'stalled'):
# return not p.stalled()
# else:
# return 1
# ===========================================================================
# HTTP Server Object
......
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