* always call close callback
* Some further explorations
* some more explorations
* Add delay while connections are closed in test
* Add a delay to make sure connections drain
* Update chia/server/server.py
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Update tests/connection_utils.py
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* use log_exceptions context manager
* set close flag correctly
* Added callback type and other changes
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Drop `get_full_node_connections` -> use `get_connections`
* Drop `connection_by_type`
I think the housekeeping required to have it isn't worth it since we
don't handle huge numbers of connections and `get_connections` should be
less enough overhead. Im open for complains though.
https://github.com/Chia-Network/chia-blockchain/actions/runs/3173913911/jobs/5170075702
```python-traceback
Traceback (most recent call last):
File "/Users/runner/work/chia-blockchain/chia-blockchain/chia/server/node_discovery.py", line 299, in _connect_to_peers
await self._query_dns(dns_address)
File "/Users/runner/work/chia-blockchain/chia-blockchain/chia/server/node_discovery.py", line 237, in _query_dns
self.log.warn(f"querying DNS introducer failed: {e}")
File "/Users/runner/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/logging/__init__.py", line 1492, in warn
warnings.warn("The 'warn' method is deprecated, "
DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
```
* more explicit and complete handling of api decorator data
* fix
* .message_class
* actually, those are different types...
* tweak
* simplify
* learn that functools.wraps copies random attributes
* configure isort to add the future annotations import
* apply the new isort setting
* remove type ignores for new mypy (#13539)
https://pypi.org/project/mypy/0.981/
* another
* Refactor away from post init for UPnP
* refactor UPnP to not be reusable
* update upnp in datalayer too
* add if_needed parameter to UPnP.shutdown()
* simpler
* be more lenient about startup failures, like before
* too many ways for UPnP to fail right now, revert to a smaller refactor approach instead of fixing them all up
* provide a skeleton hint protocol for rpc apis
* more
* more self.custom_get_connections = None
* fix RpcApiProtocol.service hinting
* catch up with RpcApiProtocol._state_changed()
* FullNode.server is now non-optional. 'ish
* drop another todo
* custom_get_connections -> get_connections
* just make get_connections() a mandatory method with a helper provided
* lots
* try again
* ._start_with_fingerprint()
* fill out the Service generic parameter in start scripts
* ... instead of pass
* add docstrings to the protocols
* remove no longer needed hasattr/not None checks
* remove outdated comment
* refactor Harvester._is_shutdown to ._shut_down
* cmds: Implement `chia beta` for the beta test program
* Unhide and document all `beta` subcommands
* Refactor all subcommands
* Introduce `chia beta configure`
* Introduce `chia beta status`
* Test all `chia beta` commands
* Use a separate file logger for beta logs
* Write the plotting call args to the log file
* Sort potential submissions
* Some refactoring around log file log handler creation
* JSON dump the plotting args
* Remove mempool.additions
* Don't re run the program, and remove program from mempool item
* Removals only stores item ids, and stores a list
* Move pending cache down to prevent cache dos
* Separate validation from adding to pool, and remove mypy exceptions
* Fix bug with replacing
* Add to mypy
* Revert cbgui
* precommit fail
* Properly update the seen dict
* lint error
* Fix mempool bug
* Enable mypy for a bunch of files
* Update after merge with main
* 99/260 remaining
* Address comments
* Enable more mypy
* Merge conflict mypy file
* More fixes
* pytest.ini and cb-gui
* One more flake8 fix
* Flake8 and tests
* More test fixes
* isort
* Make LGTM happy
* Update chia/full_node/block_store.py
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Update chia/full_node/full_node_store.py
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Update chia/wallet/util/peer_request_cache.py
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Apply all suggestions from PR comments
* Revert cb-gui
* 100 back to 1000, minor tweaks
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* No traceback for OSError 113 in WSChiaConnection.outbound_handler()
```python-traceback
Aug 16 21:24:08 fullnode chia_full_node[58416]: 2022-08-16T21:24:08.489 full_node full_node_server : ERROR Exception: [Errno 113] No route to host with 121.236.62.254
Aug 16 21:24:08 fullnode chia_full_node[58416]: 2022-08-16T21:24:08.490 full_node full_node_server : ERROR Exception Stack: Traceback (most recent call last):
Aug 16 21:24:08 fullnode chia_full_node[58416]: File "/farm/chia-blockchain/chia/server/ws_connection.py", line 262, in outbound_handler
Aug 16 21:24:08 fullnode chia_full_node[58416]: await self._send_message(msg)
Aug 16 21:24:08 fullnode chia_full_node[58416]: File "/farm/chia-blockchain/chia/server/ws_connection.py", line 416, in _send_message
Aug 16 21:24:08 fullnode chia_full_node[58416]: await self.ws.send_bytes(encoded)
Aug 16 21:24:08 fullnode chia_full_node[58416]: File "/farm/chia-blockchain/venv/lib/python3.8/site-packages/aiohttp/web_ws.py", line 315, in send_bytes
Aug 16 21:24:08 fullnode chia_full_node[58416]: await self._writer.send(data, binary=True, compress=compress)
Aug 16 21:24:08 fullnode chia_full_node[58416]: File "/farm/chia-blockchain/venv/lib/python3.8/site-packages/aiohttp/http_websocket.py", line 688, in send
Aug 16 21:24:08 fullnode chia_full_node[58416]: await self._send_frame(message, WSMsgType.BINARY, compress)
Aug 16 21:24:08 fullnode chia_full_node[58416]: File "/farm/chia-blockchain/venv/lib/python3.8/site-packages/aiohttp/http_websocket.py", line 659, in _send_frame
Aug 16 21:24:08 fullnode chia_full_node[58416]: await self.protocol._drain_helper()
Aug 16 21:24:08 fullnode chia_full_node[58416]: File "/farm/chia-blockchain/venv/lib/python3.8/site-packages/aiohttp/base_protocol.py", line 87, in _drain_helper
Aug 16 21:24:08 fullnode chia_full_node[58416]: await asyncio.shield(waiter)
Aug 16 21:24:08 fullnode chia_full_node[58416]: File "/usr/lib/python3.8/asyncio/selector_events.py", line 848, in _read_ready__data_received
Aug 16 21:24:08 fullnode chia_full_node[58416]: data = self._sock.recv(self.max_size)
Aug 16 21:24:08 fullnode chia_full_node[58416]: OSError: [Errno 113] No route to host
Aug 16 21:24:08 fullnode chia_full_node[58416]:
```
* Update ws_connection.py
* refactor
* util: Unify lockfile handling
This patch:
- Renames `util.lock.lock_by_path` to `util.lock.lock_path` and improves it by using `FileLock`
- Unifies all places where we create lock files to use `chia.util.lock.lock_path`
- Changes the daemon lockfile from `start-daemon.launching` to `daemon.lock` like we have it with all `<service>.lock` in the `run` folder
- Drops the `fastener` dependency
* Move the not keyring related sync tests into `test_lockfile.py`