[Twisted-Python] quitting clients connected to a server from serverside
Hi! I have a server with multiple clients (processing nodes) which send their data periodically to the server using PB. Now I'm trying to quit the clients from the server-side, eg. when the server is shut down. I tried to install a "quit-callback-routine" from the client on the server, which the server should start if it wants a client to shutdown. But this doesn't work, instead I get a twisted.spread.jelly.InsecureJelly: method error. Please find attached some sample-code I used for testing. I think I was 'a little' to optimistic, that things just work when trying to send methods over the net and expecting twisted to know how to handle with this. But what do I have to change, to archive the result I'm expecting? Thanks in advance Patrick
After looking through twisted.spread.db source, I noticed that it implements twisted.internet.protocol. You could use the self.transport.loseConnection facility to forcefully disconnect clients. If you want your client to do a certain routine when the server shuts him down, you could send a custom message to the client first that will trigger some cleanup procedure you have in your client. I do similar stuff like this in our twisted xmpp server. :) On Tue, May 20, 2008 at 9:55 PM, Patrick Scharrenberg <pittipatti@web.de> wrote:
Hi!
I have a server with multiple clients (processing nodes) which send their data periodically to the server using PB.
Now I'm trying to quit the clients from the server-side, eg. when the server is shut down. I tried to install a "quit-callback-routine" from the client on the server, which the server should start if it wants a client to shutdown. But this doesn't work, instead I get a twisted.spread.jelly.InsecureJelly: method error.
Please find attached some sample-code I used for testing.
I think I was 'a little' to optimistic, that things just work when trying to send methods over the net and expecting twisted to know how to handle with this.
But what do I have to change, to archive the result I'm expecting?
Thanks in advance
Patrick
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Hi Alvin, Thanks for your answer!
If you want your client to do a certain routine when the server shuts him down, you could send a custom message to the client first that will trigger some cleanup procedure you have in your client.
Yes indeed I have to do some cleanup first. What do you mean with "send a custom message"? Patrick
I mean some kind of a command from the server to trigger the cleanup of the client. For example: on some cases in our xmpp server, when a currently logged in user logged in again with using the same account from a different location; we forcefully close the last session by first sending a stream document end to the client ("</stream>") before doing a transport.loseConnection(). Our client then triggers the cleanup procedure upon receiving </stream> from the server. I haven't tried my hands on twisted.spread yet but you could implement something like this. :) On Wed, May 21, 2008 at 12:09 AM, Patrick Scharrenberg <pittipatti@web.de> wrote:
Hi Alvin,
Thanks for your answer!
If you want your client to do a certain routine when the server shuts him down, you could send a custom message to the client first that will trigger some cleanup procedure you have in your client.
Yes indeed I have to do some cleanup first. What do you mean with "send a custom message"?
Patrick
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
participants (2)
-
Alvin Delagon
-
Patrick Scharrenberg