Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
0622f6c1
Kaydet (Commit)
0622f6c1
authored
Eki 18, 2012
tarafından
Trent Nelson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #16274: backport of 3.2's asyncore/test_asyncore to 2.7.
This fixes failing tests on Solaris 10.
üst
6a7f8670
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
7 deletions
+38
-7
asyncore.py
Lib/asyncore.py
+7
-1
test_asyncore.py
Lib/test/test_asyncore.py
+31
-6
No files found.
Lib/asyncore.py
Dosyayı görüntüle @
0622f6c1
...
...
@@ -515,7 +515,13 @@ class dispatcher:
self
.
log_info
(
'unhandled connect event'
,
'warning'
)
def
handle_accept
(
self
):
self
.
log_info
(
'unhandled accept event'
,
'warning'
)
pair
=
self
.
accept
()
if
pair
is
not
None
:
self
.
handle_accepted
(
*
pair
)
def
handle_accepted
(
self
,
sock
,
addr
):
sock
.
close
()
self
.
log_info
(
'unhandled accepted event'
,
'warning'
)
def
handle_close
(
self
):
self
.
log_info
(
'unhandled close event'
,
'warning'
)
...
...
Lib/test/test_asyncore.py
Dosyayı görüntüle @
0622f6c1
...
...
@@ -296,7 +296,6 @@ class DispatcherTests(unittest.TestCase):
d
.
handle_read
()
d
.
handle_write
()
d
.
handle_connect
()
d
.
handle_accept
()
finally
:
sys
.
stdout
=
stdout
...
...
@@ -304,8 +303,7 @@ class DispatcherTests(unittest.TestCase):
expected
=
[
'warning: unhandled incoming priority event'
,
'warning: unhandled read event'
,
'warning: unhandled write event'
,
'warning: unhandled connect event'
,
'warning: unhandled accept event'
]
'warning: unhandled connect event'
]
self
.
assertEqual
(
lines
,
expected
)
def
test_issue_8594
(
self
):
...
...
@@ -453,6 +451,9 @@ class BaseTestHandler(asyncore.dispatcher):
def
handle_accept
(
self
):
raise
Exception
(
"handle_accept not supposed to be called"
)
def
handle_accepted
(
self
):
raise
Exception
(
"handle_accepted not supposed to be called"
)
def
handle_connect
(
self
):
raise
Exception
(
"handle_connect not supposed to be called"
)
...
...
@@ -483,8 +484,7 @@ class TCPServer(asyncore.dispatcher):
def
address
(
self
):
return
self
.
socket
.
getsockname
()[:
2
]
def
handle_accept
(
self
):
sock
,
addr
=
self
.
accept
()
def
handle_accepted
(
self
,
sock
,
addr
):
self
.
handler
(
sock
)
def
handle_error
(
self
):
...
...
@@ -548,6 +548,29 @@ class BaseTestAPI(unittest.TestCase):
client
=
BaseClient
(
server
.
address
)
self
.
loop_waiting_for_flag
(
server
)
def
test_handle_accepted
(
self
):
# make sure handle_accepted() is called when a client connects
class
TestListener
(
BaseTestHandler
):
def
__init__
(
self
):
BaseTestHandler
.
__init__
(
self
)
self
.
create_socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
bind
((
HOST
,
0
))
self
.
listen
(
5
)
self
.
address
=
self
.
socket
.
getsockname
()[:
2
]
def
handle_accept
(
self
):
asyncore
.
dispatcher
.
handle_accept
(
self
)
def
handle_accepted
(
self
,
sock
,
addr
):
sock
.
close
()
self
.
flag
=
True
server
=
TestListener
()
client
=
BaseClient
(
server
.
address
)
self
.
loop_waiting_for_flag
(
server
)
def
test_handle_read
(
self
):
# make sure handle_read is called on data received
...
...
@@ -671,7 +694,8 @@ class BaseTestAPI(unittest.TestCase):
s
=
asyncore
.
dispatcher
()
s
.
create_socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
assertEqual
(
s
.
socket
.
family
,
socket
.
AF_INET
)
self
.
assertEqual
(
s
.
socket
.
type
,
socket
.
SOCK_STREAM
)
SOCK_NONBLOCK
=
getattr
(
socket
,
'SOCK_NONBLOCK'
,
0
)
self
.
assertEqual
(
s
.
socket
.
type
,
socket
.
SOCK_STREAM
|
SOCK_NONBLOCK
)
def
test_bind
(
self
):
s1
=
asyncore
.
dispatcher
()
...
...
@@ -697,6 +721,7 @@ class BaseTestAPI(unittest.TestCase):
s
=
asyncore
.
dispatcher
(
socket
.
socket
())
self
.
assertFalse
(
s
.
socket
.
getsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_REUSEADDR
))
s
.
socket
.
close
()
s
.
create_socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
s
.
set_reuse_addr
()
self
.
assertTrue
(
s
.
socket
.
getsockopt
(
socket
.
SOL_SOCKET
,
...
...
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