Commit 1663c356 authored by Denis Bilenko's avatar Denis Bilenko

gevent.ares: handle string passed to set_servers()

parent 95c04fdb
...@@ -301,9 +301,13 @@ cdef public class channel [object PyGeventAresChannelObject, type PyGeventAresCh ...@@ -301,9 +301,13 @@ cdef public class channel [object PyGeventAresChannelObject, type PyGeventAresCh
cares.ares_destroy(self.channel) cares.ares_destroy(self.channel)
self.channel = NULL self.channel = NULL
def set_servers(self, object servers=[]): def set_servers(self, servers=None):
if not self.channel: if not self.channel:
raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed') raise gaierror(cares.ARES_EDESTRUCTION, 'this ares channel has been destroyed')
if not servers:
servers = []
if isinstance(servers, basestring):
servers = servers.split(',')
cdef int length = len(servers) cdef int length = len(servers)
cdef int result, index cdef int result, index
cdef char* string cdef char* string
......
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