Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
ecc32885
Commit
ecc32885
authored
8 years ago
by
Makarand Dharmapurikar
Browse files
Options
Downloads
Patches
Plain Diff
WIP
parent
4350e748
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/http2_test/http2_base_server.py
+6
-5
6 additions, 5 deletions
test/http2_test/http2_base_server.py
test/http2_test/http2_test_server.py
+1
-0
1 addition, 0 deletions
test/http2_test/http2_test_server.py
test/http2_test/test_goaway.py
+3
-1
3 additions, 1 deletion
test/http2_test/test_goaway.py
with
10 additions
and
6 deletions
test/http2_test/http2_base_server.py
+
6
−
5
View file @
ecc32885
...
...
@@ -113,9 +113,6 @@ class H2ProtocolBaseServer(Protocol):
return
while
self
.
_send_remaining
[
stream_id
]
>
0
:
if
self
.
_stream_status
[
stream_id
]
is
False
:
logging
.
info
(
'
Stream %d is closed.
'
%
stream_id
)
break
lfcw
=
self
.
_conn
.
local_flow_control_window
(
stream_id
)
if
lfcw
==
0
:
break
...
...
@@ -125,7 +122,11 @@ class H2ProtocolBaseServer(Protocol):
(
lfcw
,
self
.
_send_offset
,
self
.
_send_offset
+
bytes_to_send
,
stream_id
))
data
=
self
.
_data_to_send
[
self
.
_send_offset
:
self
.
_send_offset
+
bytes_to_send
]
self
.
_conn
.
send_data
(
stream_id
,
data
,
False
)
try
:
self
.
_conn
.
send_data
(
stream_id
,
data
,
False
)
except
ProtocolError
:
logging
.
info
(
'
Stream %d is closed
'
%
stream_id
)
break
self
.
_send_remaining
[
stream_id
]
-=
bytes_to_send
self
.
_send_offset
+=
bytes_to_send
if
self
.
_send_remaining
[
stream_id
]
==
0
:
...
...
@@ -163,7 +164,7 @@ class H2ProtocolBaseServer(Protocol):
asked in request
"""
grpc_msg_size
=
struct
.
unpack
(
'
i
'
,
recv_buffer
[
1
:
5
][::
-
1
])[
0
]
if
len
(
recv_buffer
)
!=
GRPC_HEADER_SIZE
+
grpc_msg_size
:
logging
.
error
(
'
not enough data to decode req proto. size = %d, needed %s
'
%
(
len
(
recv_buffer
),
5
+
grpc_msg_size
))
#
logging.error('not enough data to decode req proto. size = %d, needed %s'%(len(recv_buffer), 5+grpc_msg_size))
return
None
req_proto_str
=
recv_buffer
[
5
:
5
+
grpc_msg_size
]
sr
=
messages_pb2
.
SimpleRequest
()
...
...
This diff is collapsed.
Click to expand it.
test/http2_test/http2_test_server.py
+
1
−
0
View file @
ecc32885
...
...
@@ -21,6 +21,7 @@ class H2Factory(Factory):
def
buildProtocol
(
self
,
addr
):
self
.
_num_streams
+=
1
logging
.
info
(
'
New Connection: %d
'
%
self
.
_num_streams
)
if
self
.
_testcase
==
'
rst_after_header
'
:
t
=
test_rst_after_header
.
TestcaseRstStreamAfterHeader
()
elif
self
.
_testcase
==
'
rst_after_data
'
:
...
...
This diff is collapsed.
Click to expand it.
test/http2_test/test_goaway.py
+
3
−
1
View file @
ecc32885
import
logging
import
time
import
http2_base_server
class
TestcaseGoaway
(
object
):
...
...
@@ -23,11 +24,12 @@ class TestcaseGoaway(object):
def
on_connection_lost
(
self
,
reason
):
logging
.
info
(
'
Disconnect received. Count %d
'
%
self
.
_iteration
)
# _iteration == 2 => Two different connections have been used.
if
self
.
_iteration
==
2
:
if
self
.
_iteration
==
2
00
:
self
.
_base_server
.
on_connection_lost
(
reason
)
def
on_send_done
(
self
,
stream_id
):
self
.
_base_server
.
on_send_done_default
(
stream_id
)
time
.
sleep
(
1
)
logging
.
info
(
'
Sending GOAWAY for stream %d:
'
%
stream_id
)
self
.
_base_server
.
_conn
.
close_connection
(
error_code
=
0
,
additional_data
=
None
,
last_stream_id
=
stream_id
)
self
.
_base_server
.
_stream_status
[
stream_id
]
=
False
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment