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
c27a8afc
Kaydet (Commit)
c27a8afc
authored
Ock 26, 2015
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge 3.4 (asyncio)
üst
5474d0ba
41063d2a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
29 deletions
+32
-29
windows_events.py
Lib/asyncio/windows_events.py
+30
-27
overlapped.c
Modules/overlapped.c
+2
-2
No files found.
Lib/asyncio/windows_events.py
Dosyayı görüntüle @
c27a8afc
...
...
@@ -126,14 +126,12 @@ class _BaseWaitHandleFuture(futures.Future):
return
self
.
_registered
=
False
wait_handle
=
self
.
_wait_handle
self
.
_wait_handle
=
None
try
:
_overlapped
.
UnregisterWait
(
self
.
_
wait_handle
)
_overlapped
.
UnregisterWait
(
wait_handle
)
except
OSError
as
exc
:
self
.
_wait_handle
=
None
if
exc
.
winerror
==
_overlapped
.
ERROR_IO_PENDING
:
# ERROR_IO_PENDING is not an error, the wait was unregistered
self
.
_unregister_wait_cb
(
None
)
elif
exc
.
winerror
!=
_overlapped
.
ERROR_IO_PENDING
:
if
exc
.
winerror
!=
_overlapped
.
ERROR_IO_PENDING
:
context
=
{
'message'
:
'Failed to unregister the wait handle'
,
'exception'
:
exc
,
...
...
@@ -142,9 +140,10 @@ class _BaseWaitHandleFuture(futures.Future):
if
self
.
_source_traceback
:
context
[
'source_traceback'
]
=
self
.
_source_traceback
self
.
_loop
.
call_exception_handler
(
context
)
else
:
self
.
_wait_handle
=
None
self
.
_unregister_wait_cb
(
None
)
return
# ERROR_IO_PENDING means that the unregister is pending
self
.
_unregister_wait_cb
(
None
)
def
cancel
(
self
):
self
.
_unregister_wait
()
...
...
@@ -209,14 +208,12 @@ class _WaitHandleFuture(_BaseWaitHandleFuture):
return
self
.
_registered
=
False
wait_handle
=
self
.
_wait_handle
self
.
_wait_handle
=
None
try
:
_overlapped
.
UnregisterWaitEx
(
self
.
_
wait_handle
,
self
.
_event
)
_overlapped
.
UnregisterWaitEx
(
wait_handle
,
self
.
_event
)
except
OSError
as
exc
:
self
.
_wait_handle
=
None
if
exc
.
winerror
==
_overlapped
.
ERROR_IO_PENDING
:
# ERROR_IO_PENDING is not an error, the wait was unregistered
self
.
_unregister_wait_cb
(
None
)
elif
exc
.
winerror
!=
_overlapped
.
ERROR_IO_PENDING
:
if
exc
.
winerror
!=
_overlapped
.
ERROR_IO_PENDING
:
context
=
{
'message'
:
'Failed to unregister the wait handle'
,
'exception'
:
exc
,
...
...
@@ -225,11 +222,11 @@ class _WaitHandleFuture(_BaseWaitHandleFuture):
if
self
.
_source_traceback
:
context
[
'source_traceback'
]
=
self
.
_source_traceback
self
.
_loop
.
call_exception_handler
(
context
)
else
:
self
.
_wait_handle
=
None
self
.
_event_fut
=
self
.
_proactor
.
_wait_cancel
(
self
.
_event
,
self
.
_unregister_wait_cb
)
return
# ERROR_IO_PENDING is not an error, the wait was unregistered
self
.
_event_fut
=
self
.
_proactor
.
_wait_cancel
(
self
.
_event
,
self
.
_unregister_wait_cb
)
class
PipeServer
(
object
):
...
...
@@ -409,13 +406,21 @@ class IocpProactor:
self
.
_results
=
[]
return
tmp
def
_result
(
self
,
value
):
fut
=
futures
.
Future
(
loop
=
self
.
_loop
)
fut
.
set_result
(
value
)
return
fut
def
recv
(
self
,
conn
,
nbytes
,
flags
=
0
):
self
.
_register_with_iocp
(
conn
)
ov
=
_overlapped
.
Overlapped
(
NULL
)
if
isinstance
(
conn
,
socket
.
socket
):
ov
.
WSARecv
(
conn
.
fileno
(),
nbytes
,
flags
)
else
:
ov
.
ReadFile
(
conn
.
fileno
(),
nbytes
)
try
:
if
isinstance
(
conn
,
socket
.
socket
):
ov
.
WSARecv
(
conn
.
fileno
(),
nbytes
,
flags
)
else
:
ov
.
ReadFile
(
conn
.
fileno
(),
nbytes
)
except
BrokenPipeError
:
return
self
.
_result
(
b
''
)
def
finish_recv
(
trans
,
key
,
ov
):
try
:
...
...
@@ -508,9 +513,7 @@ class IocpProactor:
# ConnectNamePipe() failed with ERROR_PIPE_CONNECTED which means
# that the pipe is connected. There is no need to wait for the
# completion of the connection.
f
=
futures
.
Future
(
loop
=
self
.
_loop
)
f
.
set_result
(
pipe
)
return
f
return
self
.
_result
(
pipe
)
def
finish_accept_pipe
(
trans
,
key
,
ov
):
ov
.
getresult
()
...
...
Modules/overlapped.c
Dosyayı görüntüle @
c27a8afc
...
...
@@ -730,7 +730,7 @@ Overlapped_ReadFile(OverlappedObject *self, PyObject *args)
switch
(
err
)
{
case
ERROR_BROKEN_PIPE
:
mark_as_completed
(
&
self
->
overlapped
);
Py_RETURN_NONE
;
return
SetFromWindowsErr
(
err
)
;
case
ERROR_SUCCESS
:
case
ERROR_MORE_DATA
:
case
ERROR_IO_PENDING
:
...
...
@@ -789,7 +789,7 @@ Overlapped_WSARecv(OverlappedObject *self, PyObject *args)
switch
(
err
)
{
case
ERROR_BROKEN_PIPE
:
mark_as_completed
(
&
self
->
overlapped
);
Py_RETURN_NONE
;
return
SetFromWindowsErr
(
err
)
;
case
ERROR_SUCCESS
:
case
ERROR_MORE_DATA
:
case
ERROR_IO_PENDING
:
...
...
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