[Twisted-Python] Porting Apache Mina to Twisted

Umut Aydin devnetwork at gmail.com
Mon Dec 6 18:00:44 EST 2010

Thank you for your response.

Probably that works and also itamar's approach seems right.

If  connectionLost method is being called every disconnection (no
matter what reason is) my unregisterBySocket method handles that
situation already. I mean It s not possible to have disconnected
socket in my job pool(work).


On Mon, Dec 6, 2010 at 5:16 PM, Godson Gera <godson.g at gmail.com> wrote:
> On Mon, Dec 6, 2010 at 7:41 PM, Umut Aydin <devnetwork at gmail.com> wrote:
>> Hello again
>> I couldn't get any answer to my question and I think I couldn't point
>> my problem clearly.
>> https://github.com/naimon/Jobbar/blob/master/src/lib/server.py
>> On the line #130 I need to check if the socket is still connected.
>> That worker variable is a copy of self.transport actually. I have
>> found it's an instance of twisted.internet.tcp.Server
>> I also found getHandle method to reach the actual socket but I
>> couldn't find any method to check its availability.
> Store a reference to the protocol object it self instead of protcol's
> transport.
> Connectiong checking  can be done easily by simply adding a state attribute
> to your protocol class. In your protocol define self.isConnected = False .
> Set that attribute to True inside connectionMade() event method and set that
> to False inside connectionLost() event.
> --
> Thanks & Regards,
> Godson Gera.
> Twisted Python Consultant India
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Best Regards,

Email: me at umut.mobi

Skype: umut-aydin

Blog: http://umut.mobi

More information about the Twisted-Python mailing list