Skip to content

Commit

Permalink
Polling fixes and session code cleanup (thanks Enki)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjoes committed Aug 1, 2011
1 parent edc8ad1 commit bf8afc6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion tornadio/polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ class TornadioHtmlFileSocketHandler(TornadioPollingHandlerBase):
@asynchronous
def get(self, *args, **kwargs):
if not self.session.set_handler(self):
# TODO: Error logging
raise HTTPError(401, 'Forbidden')

self.set_header('Content-Type', 'text/html')
Expand Down Expand Up @@ -311,6 +310,11 @@ def post(self, *args, **kwargs):
super(TornadioJSONPSocketHandler, self).post(*args, **kwargs)

def data_available(self, raw_data):
if not self._index:


raise HTTPError(401, 'unauthorized')

message = 'io.JSONP[%s]._(%s);' % (
self._index,
json.dumps(raw_data)
Expand Down
3 changes: 1 addition & 2 deletions tornadio/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ def remove(self, session_id):
session = self._items.get(session_id, None)

if session is not None:
self._items[session].promoted = -1
session.promoted = -1
session.on_delete(True)
del self._items[session_id]
return True

return False
Expand Down

0 comments on commit bf8afc6

Please sign in to comment.