• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #include "src/core/lib/surface/server.h"
20 #include "test/core/bad_client/bad_client.h"
21 
22 #define PFX_STR                      \
23   "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \
24   "\x00\x00\x00\x04\x00\x00\x00\x00\x00"
25 
verifier(grpc_server * server,grpc_completion_queue * cq,void * registered_method)26 static void verifier(grpc_server* server, grpc_completion_queue* cq,
27                      void* registered_method) {
28   while (grpc_server_has_open_connections(server)) {
29     GPR_ASSERT(grpc_completion_queue_next(
30                    cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
31                    .type == GRPC_QUEUE_TIMEOUT);
32   }
33 }
34 
main(int argc,char ** argv)35 int main(int argc, char** argv) {
36   grpc_init();
37   grpc_test_init(argc, argv);
38 
39   /* test adding prioritization data */
40   GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
41                            PFX_STR "\x00\x00\x00\x88\x00\x00\x00\x00\x01",
42                            GRPC_BAD_CLIENT_DISCONNECT);
43 
44   grpc_shutdown();
45   return 0;
46 }
47