Message233476
I withdraw my patch as (I just discovered), it is already possible to effect changes to the underlying connection. What /should/ be done is:
transport = Transport()
con = transport.make_connection([host])
con.timeout = 2
proxy = ServerProxy([url], transport=transport)
As the connection will not be created until an RPC method is called, the timeout value assigned to the connection will be observed on socket creation. Making such modifications to the underlying transport should be documented.
That said, what is a little less than optimal is that the transport attribute of a ServerProxy object is inaccessible (without hackery) after instantiation, so socket level changes are impossible if not using a custom transport. What would be nice would be to add an accessor for ServerProxy.__transport. Likewise, Transport._connection is marked as part of the private interface. Adding public accessors would allow for something like this:
proxy = ServerProxy([url])
# pre-connect timeout
proxy.transport.connection.timeout = 2
proxy.system.listMethods()
or
proxy = ServerProxy([url])
proxy.system.listMethods()
# socket is available as connection has been established
proxy.transport.connection.sock.settimeout(2) |
|
Date |
User |
Action |
Args |
2015-01-05 19:24:35 | demian.brecht | set | recipients:
+ demian.brecht, loewis, flox, mcjeff, polymorphm, berker.peksag |
2015-01-05 19:24:34 | demian.brecht | set | messageid: <1420485874.95.0.0973826513848.issue14134@psf.upfronthosting.co.za> |
2015-01-05 19:24:34 | demian.brecht | link | issue14134 messages |
2015-01-05 19:24:34 | demian.brecht | create | |
|