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