fcntl not present in windows
This commit is contained in:
		
							parent
							
								
									7f25dbd34a
								
							
						
					
					
						commit
						a9a2b483cb
					
				
					 1 changed files with 9 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -21,7 +21,10 @@
 | 
			
		|||
 | 
			
		||||
import socket
 | 
			
		||||
import select
 | 
			
		||||
import fcntl
 | 
			
		||||
try:
 | 
			
		||||
	import fcntl
 | 
			
		||||
except:
 | 
			
		||||
	pass
 | 
			
		||||
import struct
 | 
			
		||||
import sha
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -133,6 +136,7 @@ class Socks5:
 | 
			
		|||
			
 | 
			
		||||
	def disconnect(self):
 | 
			
		||||
		''' Closes the socket. '''
 | 
			
		||||
		if 'fcntl' in globals():
 | 
			
		||||
			fcntl.fcntl(self._sock, fcntl.F_SETFL, 0);
 | 
			
		||||
		self._sock.close()
 | 
			
		||||
		self.connected = False
 | 
			
		||||
| 
						 | 
				
			
			@ -245,6 +249,7 @@ class Socks5Receiver(Socks5):
 | 
			
		|||
	def disconnect(self):
 | 
			
		||||
		''' Closes the socket. '''
 | 
			
		||||
		# close connection and remove us from the queue
 | 
			
		||||
		if 'fcntl' in globals():
 | 
			
		||||
			fcntl.fcntl(self._sock, fcntl.F_SETFL, 0);
 | 
			
		||||
		self._sock.close()
 | 
			
		||||
		self.connected = False
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue