Context temporarily setting the default socket timeout. Note: Only affects sockets created afterwards. To bound a connection that is already open, use :func:`bound_open_broker_sockets`.
(timeout)
| 35 | |
| 36 | @contextmanager |
| 37 | def default_socket_timeout(timeout): |
| 38 | """Context temporarily setting the default socket timeout. |
| 39 | |
| 40 | Note: |
| 41 | Only affects sockets created afterwards. To bound a connection |
| 42 | that is already open, use :func:`bound_open_broker_sockets`. |
| 43 | """ |
| 44 | prev = socket.getdefaulttimeout() |
| 45 | socket.setdefaulttimeout(timeout) |
| 46 | try: |
| 47 | yield |
| 48 | finally: |
| 49 | socket.setdefaulttimeout(prev) |
| 50 | |
| 51 | |
| 52 | def _open_broker_sockets(connection): |
no outgoing calls