Browse files

Sorry, no more spawning benchmarks.

git-svn-id: http://evserver.googlecode.com/svn/trunk@45 e9bb6d7e-af12-11dd-bad7-87afd3b02348
  • Loading branch information...
1 parent 2d8912d commit 524fecafa057f43ab213ccd29450db6f27afed66 majek04 committed Dec 4, 2008
Showing with 7 additions and 41 deletions.
  1. +6 −2 evserver/examples/static/comet.js
  2. +1 −39 evserver/examples/staticfiles.py
View
8 evserver/examples/static/comet.js
@@ -114,8 +114,12 @@ function schedule_connection_longpoll(url, callback, server_reconnect) {
schedule();
callback( data );
- }else
- server_reconnect(true);
+ }else{
+ // just try again:
+ if(schedule)
+ schedule();
+ // server_reconnect(true);
+ }
}
}
View
40 evserver/examples/staticfiles.py
@@ -24,7 +24,7 @@ def application(environ, start_response):
fd = open(path, 'rb')
data = fd.read() # could be changed to yielding if the file is slow
fd.close()
-
+
mt = mimetypes.guess_type(path)[0]
if not mt: mt = 'text/html; charset=utf-8'
headers = [('Content-type', mt)]
@@ -33,41 +33,3 @@ def application(environ, start_response):
code, headers, data = file_cache[path]
start_response(code, headers)
return [data]
-
-
-import socket
-def application_comet_spawn(environ, start_response):
- start_response('200 OK', [('Content-type','text/plain')])
- def iterator():
- sd = socket.socket()
- sd.bind( ('127.0.0.1', 0) )
- sd.listen(2)
- try:
- for i in range(10):
- sd.settimeout(0.1)
- try:
- sd.accept()
- except Exception: pass
- yield 'ping\r\n' # this is not working for spawning
- except GeneratorExit:
- pass
- sd.close()
- return iterator()
-
-def application_comet_awsgi(environ, start_response):
- start_response('200 OK', [('Content-type','text/plain')])
- def iterator():
- sd = socket.socket()
- sd.bind( ('127.0.0.1', 0) )
- sd.listen(2)
- try:
- for i in range(10):
- yield environ['x-wsgiorg.fdevent.readable'](sd, 0.1)
- yield 'ping\r\n'
- except GeneratorExit:
- pass
- sd.close()
- return iterator()
-
-
-

0 comments on commit 524feca

Please sign in to comment.