Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
68522b18
Commit
68522b18
authored
Mar 21, 2004
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Part of patch #909005] Use True/False
parent
c3a87b8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
Lib/asyncore.py
Lib/asyncore.py
+13
-13
No files found.
Lib/asyncore.py
View file @
68522b18
...
@@ -157,7 +157,7 @@ def poll2(timeout=0.0, map=None):
...
@@ -157,7 +157,7 @@ def poll2(timeout=0.0, map=None):
poll3
=
poll2
# Alias for backward compatibility
poll3
=
poll2
# Alias for backward compatibility
def
loop
(
timeout
=
30.0
,
use_poll
=
0
,
map
=
None
):
def
loop
(
timeout
=
30.0
,
use_poll
=
False
,
map
=
None
):
if
map
is
None
:
if
map
is
None
:
map
=
socket_map
map
=
socket_map
...
@@ -171,10 +171,10 @@ def loop(timeout=30.0, use_poll=0, map=None):
...
@@ -171,10 +171,10 @@ def loop(timeout=30.0, use_poll=0, map=None):
class
dispatcher
:
class
dispatcher
:
debug
=
0
debug
=
False
connected
=
0
connected
=
False
accepting
=
0
accepting
=
False
closing
=
0
closing
=
False
addr
=
None
addr
=
None
def
__init__
(
self
,
sock
=
None
,
map
=
None
):
def
__init__
(
self
,
sock
=
None
,
map
=
None
):
...
@@ -187,7 +187,7 @@ class dispatcher:
...
@@ -187,7 +187,7 @@ class dispatcher:
self
.
set_socket
(
sock
,
map
)
self
.
set_socket
(
sock
,
map
)
# I think it should inherit this anyway
# I think it should inherit this anyway
self
.
socket
.
setblocking
(
0
)
self
.
socket
.
setblocking
(
0
)
self
.
connected
=
1
self
.
connected
=
True
# XXX Does the constructor require that the socket passed
# XXX Does the constructor require that the socket passed
# be connected?
# be connected?
try
:
try
:
...
@@ -273,7 +273,7 @@ class dispatcher:
...
@@ -273,7 +273,7 @@ class dispatcher:
# ==================================================
# ==================================================
def
listen
(
self
,
num
):
def
listen
(
self
,
num
):
self
.
accepting
=
1
self
.
accepting
=
True
if
os
.
name
==
'nt'
and
num
>
5
:
if
os
.
name
==
'nt'
and
num
>
5
:
num
=
1
num
=
1
return
self
.
socket
.
listen
(
num
)
return
self
.
socket
.
listen
(
num
)
...
@@ -283,14 +283,14 @@ class dispatcher:
...
@@ -283,14 +283,14 @@ class dispatcher:
return
self
.
socket
.
bind
(
addr
)
return
self
.
socket
.
bind
(
addr
)
def
connect
(
self
,
address
):
def
connect
(
self
,
address
):
self
.
connected
=
0
self
.
connected
=
False
err
=
self
.
socket
.
connect_ex
(
address
)
err
=
self
.
socket
.
connect_ex
(
address
)
# XXX Should interpret Winsock return values
# XXX Should interpret Winsock return values
if
err
in
(
EINPROGRESS
,
EALREADY
,
EWOULDBLOCK
):
if
err
in
(
EINPROGRESS
,
EALREADY
,
EWOULDBLOCK
):
return
return
if
err
in
(
0
,
EISCONN
):
if
err
in
(
0
,
EISCONN
):
self
.
addr
=
address
self
.
addr
=
address
self
.
connected
=
1
self
.
connected
=
True
self
.
handle_connect
()
self
.
handle_connect
()
else
:
else
:
raise
socket
.
error
,
err
raise
socket
.
error
,
err
...
@@ -360,11 +360,11 @@ class dispatcher:
...
@@ -360,11 +360,11 @@ class dispatcher:
# for an accepting socket, getting a read implies
# for an accepting socket, getting a read implies
# that we are connected
# that we are connected
if
not
self
.
connected
:
if
not
self
.
connected
:
self
.
connected
=
1
self
.
connected
=
True
self
.
handle_accept
()
self
.
handle_accept
()
elif
not
self
.
connected
:
elif
not
self
.
connected
:
self
.
handle_connect
()
self
.
handle_connect
()
self
.
connected
=
1
self
.
connected
=
True
self
.
handle_read
()
self
.
handle_read
()
else
:
else
:
self
.
handle_read
()
self
.
handle_read
()
...
@@ -373,7 +373,7 @@ class dispatcher:
...
@@ -373,7 +373,7 @@ class dispatcher:
# getting a write implies that we are connected
# getting a write implies that we are connected
if
not
self
.
connected
:
if
not
self
.
connected
:
self
.
handle_connect
()
self
.
handle_connect
()
self
.
connected
=
1
self
.
connected
=
True
self
.
handle_write
()
self
.
handle_write
()
def
handle_expt_event
(
self
):
def
handle_expt_event
(
self
):
...
@@ -518,7 +518,7 @@ if os.name == 'posix':
...
@@ -518,7 +518,7 @@ if os.name == 'posix':
def
__init__
(
self
,
fd
):
def
__init__
(
self
,
fd
):
dispatcher
.
__init__
(
self
)
dispatcher
.
__init__
(
self
)
self
.
connected
=
1
self
.
connected
=
True
# set it to non-blocking mode
# set it to non-blocking mode
flags
=
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFL
,
0
)
flags
=
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFL
,
0
)
flags
=
flags
|
os
.
O_NONBLOCK
flags
=
flags
|
os
.
O_NONBLOCK
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment