1

In gevent 1.0.2 , i am using StreamServer , and when handling a connection i am keeping sockets in a dict to send events waiting on queue, this works fine in 1.0.2 , but not in the latest version 1.1.x the socket just closes when returned from the connection handler. How can i make this work with latest gevent in python.

def add_listener(self, stream_id , socket):
    socket.send(OK_200)
    self.event_listeners[stream_id][socket] = True

I am just keeping open sockets in a dictionary, broadcast events when there are some events. This works fine in 1.0.2 version , but with the latest 1.1.x just closes this socket when returned from connection handler.

user303730
  • 384
  • 1
  • 5
  • 15

1 Answers1

0

Got help from IRC ,

<champax> think you hit : https://github.com/gevent/gevent/issues/594
<champax> you myay have to override do_close
<champax> *may
<pigmej> no, just don't return from handler
<champax> yeah working too
<ahbinav> i am waiting on a queue for events and broadcasting to list of sockets when event arrives in the queue. So, overriding do_close should do for me. I will try that. 

The behaviour is documented. override do_close with nothing in the streamServer is the answer that worked for me.

user303730
  • 384
  • 1
  • 5
  • 15