File tree Expand file tree Collapse file tree 1 file changed +26
-5
lines changed Expand file tree Collapse file tree 1 file changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -109,11 +109,32 @@ def close(self):
109109
110110    def  _close_self_pipe (self ):
111111        self ._remove_reader (self ._ssock .fileno ())
112-         self ._ssock .close ()
113-         self ._ssock  =  None 
114-         self ._csock .close ()
115-         self ._csock  =  None 
116-         self ._internal_fds  -=  1 
112+         
113+         # Handle shutdown and close for _ssock 
114+         if  self ._ssock :
115+             try :
116+                 self ._ssock .shutdown (socket .SHUT_RDWR )
117+             except  OSError  as  e :
118+                 # Log the error or handle it as necessary 
119+                 print (f"Error shutting down _ssock: { e }  )
120+             finally :
121+                 self ._ssock .close ()
122+                 self ._ssock  =  None 
123+         
124+         # Handle shutdown and close for _csock 
125+         if  self ._csock :
126+             try :
127+                 self ._csock .shutdown (socket .SHUT_RDWR )
128+             except  OSError  as  e :
129+                 # Log the error or handle it as necessary 
130+                 print (f"Error shutting down _csock: { e }  )
131+             finally :
132+                 self ._csock .close ()
133+                 self ._csock  =  None 
134+     
135+     self ._internal_fds  -=  1 
136+ 
137+ 
117138
118139    def  _make_self_pipe (self ):
119140        # A self-socket, really. :-) 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments