OSError, not only an AssertionError. Instead of maintaining a dead code path and enumerating disconnect reasons, just assume disconnection happens every time.
        
      OSError, not only an AssertionError. Instead of maintaining a dead code path and enumerating disconnect reasons, just assume disconnection happens every time.
        
      For example https://cirrus-ci.com/task/5642614044098560?logs=ci#L3315
 0 node0 2022-05-13T06:33:06.355942Z [msghand] [net_processing.cpp:4178] [MaybeDiscourageAndDisconnect] Warning: disconnecting but not discouraging local peer 1! 
 1 node0 2022-05-13T06:33:06.355985Z [net] [net.cpp:567] [CloseSocketDisconnect] disconnecting peer=1 
 2 test  2022-05-13T06:33:06.356000Z TestFramework.p2p (DEBUG): Closed connection to: 127.0.0.1:11408 
 3 test  2022-05-13T06:33:06.356000Z TestFramework.p2p (DEBUG): Send message to 127.0.0.1:11408: msg_ping(nonce=00000007) 
 4 test  2022-05-13T06:33:06.356000Z TestFramework (ERROR): Unexpected exception caught during testing 
 5                                   Traceback (most recent call last):
 6                                     File "/tmp/cirrus-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 133, in main
 7                                       self.run_test()
 8                                     File "/tmp/cirrus-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_unrequested_blocks.py", line 264, in run_test
 9                                       test_node.sync_with_ping(timeout=1)
10                                     File "/tmp/cirrus-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/p2p.py", line 555, in sync_with_ping
11                                       self.send_message(msg_ping(nonce=self.ping_counter))
12                                     File "/tmp/cirrus-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/p2p.py", line 266, in send_message
13                                       return self.send_raw_message(tmsg)
14                                     File "/tmp/cirrus-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/p2p.py", line 270, in send_raw_message
15                                       raise IOError('Not connected')
16                                   OSError: Not connected
          Labels
          
          
  
    
Tests