Skip to content
Browse files

Add methods to remove deprecation warnings from asyncore

  • Loading branch information...
1 parent 117f62d commit e918d1591bc527ae6d0a3c34eb3a475e51467e61 @gmr gmr committed May 7, 2014
Showing with 10 additions and 4 deletions.
  1. +10 −4 pika/adapters/asyncore_connection.py
View
14 pika/adapters/asyncore_connection.py
@@ -25,7 +25,6 @@ def __init__(self, sock=None, map=None, event_callback=None):
self._event_callback = event_callback
self.events = self.READ | self.WRITE
-
def add_timeout(self, deadline, callback_method):
"""Add the callback_method to the IOLoop timer to fire after deadline
seconds. Returns a handle to the timeout. Do not confuse with
@@ -43,17 +42,23 @@ def add_timeout(self, deadline, callback_method):
self._timeouts[timeout_id] = value
return timeout_id
+ def fileno(self):
+ return self.socket.fileno()
+
+ def sendall(self, data):
+ return self.socket.sendall(data)
+
def readable(self):
return bool(self.events & self.READ)
def writable(self):
return bool(self.events & self.WRITE)
def handle_read(self):
- self._event_callback(self.socket, self.READ)
+ self._event_callback(self.socket.fileno, self.READ)
def handle_write(self):
- self._event_callback(self.socket, self.WRITE, None, True)
+ self._event_callback(self.socket.fileno, self.WRITE, None, True)
def process_timeouts(self):
"""Process the self._timeouts event stack"""
@@ -143,7 +148,8 @@ def _adapter_connect(self):
"""
error = super(AsyncoreConnection, self)._adapter_connect()
if not error:
- self.socket = PikaDispatcher(self.socket, None, self._handle_events)
+ self.socket = PikaDispatcher(self.socket, None,
+ self._handle_events)
self.ioloop = self.socket
self._on_connected()
return error

0 comments on commit e918d15

Please sign in to comment.
Something went wrong with that request. Please try again.