mirror of
https://gitee.com/fantix/kloop.git
synced 2024-11-21 18:01:00 +00:00
Fix TLS 1.3 control messages after handshake
This commit is contained in:
parent
761f741d5d
commit
3c2d02a3f9
1 changed files with 19 additions and 2 deletions
|
@ -168,7 +168,11 @@ cdef int bio_read_ex(
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
bio.clear_retry_flags(b)
|
bio.clear_retry_flags(b)
|
||||||
if proxy.flags & FLAGS_PROXY_RECV_KTLS:
|
if (
|
||||||
|
proxy.flags & FLAGS_PROXY_RECV_KTLS and
|
||||||
|
proxy.flags & FLAGS_PROXY_RECV_COMPLETED
|
||||||
|
):
|
||||||
|
proxy.flags &= ~FLAGS_PROXY_RECV_ALL
|
||||||
res = proxy.recv_callback.res
|
res = proxy.recv_callback.res
|
||||||
if datal < res + 5:
|
if datal < res + 5:
|
||||||
IF DEBUG:
|
IF DEBUG:
|
||||||
|
@ -244,7 +248,15 @@ cdef int bio_read_ex(
|
||||||
bio.set_retry_read(b)
|
bio.set_retry_read(b)
|
||||||
readbytes[0] = 0
|
readbytes[0] = 0
|
||||||
if not proxy.flags & FLAGS_PROXY_RECV_SUBMITTED:
|
if not proxy.flags & FLAGS_PROXY_RECV_SUBMITTED:
|
||||||
if is_ktls:
|
if proxy.flags & FLAGS_PROXY_RECV_KTLS:
|
||||||
|
reset_msg(&proxy.recv_msg, proxy.cmsg)
|
||||||
|
IF DEBUG:
|
||||||
|
with gil:
|
||||||
|
print("bio_read_ex() submit(%x, %d)" % (
|
||||||
|
<long long>proxy.recv_vec.iov_base,
|
||||||
|
proxy.recv_vec.iov_len,
|
||||||
|
))
|
||||||
|
elif is_ktls:
|
||||||
if datal < 21:
|
if datal < 21:
|
||||||
IF DEBUG:
|
IF DEBUG:
|
||||||
with gil:
|
with gil:
|
||||||
|
@ -505,6 +517,7 @@ cdef class TLSTransport:
|
||||||
if record_type != ssl_h.SSL3_RT_APPLICATION_DATA:
|
if record_type != ssl_h.SSL3_RT_APPLICATION_DATA:
|
||||||
IF DEBUG:
|
IF DEBUG:
|
||||||
print("do_read_ktls() forward CMSG")
|
print("do_read_ktls() forward CMSG")
|
||||||
|
self.proxy.flags |= FLAGS_PROXY_RECV_COMPLETED
|
||||||
return self.do_read()
|
return self.do_read()
|
||||||
IF DEBUG:
|
IF DEBUG:
|
||||||
print("do_read_ktls() received", res, "bytes")
|
print("do_read_ktls() received", res, "bytes")
|
||||||
|
@ -557,10 +570,14 @@ cdef class TLSTransport:
|
||||||
self.loop.call_soon(self.protocol.connection_lost, None)
|
self.loop.call_soon(self.protocol.connection_lost, None)
|
||||||
|
|
||||||
cdef write_cb(self, int res):
|
cdef write_cb(self, int res):
|
||||||
|
IF DEBUG:
|
||||||
|
print("write_cb", res, "state:", self.state)
|
||||||
if self.state == HANDSHAKING:
|
if self.state == HANDSHAKING:
|
||||||
self.do_handshake()
|
self.do_handshake()
|
||||||
|
|
||||||
cdef read_cb(self, int res):
|
cdef read_cb(self, int res):
|
||||||
|
IF DEBUG:
|
||||||
|
print("read_cb", res, "state:", self.state)
|
||||||
if self.state == HANDSHAKING:
|
if self.state == HANDSHAKING:
|
||||||
self.do_handshake()
|
self.do_handshake()
|
||||||
elif self.state == WRAPPED:
|
elif self.state == WRAPPED:
|
||||||
|
|
Loading…
Reference in a new issue