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). Right? On Mon, Dec 6, 2010 at 5:16 PM, Godson Gera <[email protected]> wrote: > > > On Mon, Dec 6, 2010 at 7:41 PM, Umut Aydin <[email protected]> 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 > [email protected] > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python > > -- Best Regards, Umut AYDIN Email: [email protected] Skype: umut-aydin Blog: http://umut.mobi _______________________________________________ Twisted-Python mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
