Skip to content

Commit

Permalink
Return empty list in gRPC list calls with an error
Browse files Browse the repository at this point in the history
  • Loading branch information
PlagueCZ authored and guvenc committed Jul 3, 2023
1 parent 9a7c100 commit 1a773f8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion include/grpc/dp_grpc_responder.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ static inline void dp_grpc_set_multireply(struct dp_grpc_responder *responder, s
{
responder->msg_size = msg_size;
responder->rep_capacity = responder->rep_max_size / msg_size;
responder->rep_msgcount = 0;
}

int dp_grpc_alloc_reply(struct dp_grpc_responder *responder);
Expand Down
2 changes: 1 addition & 1 deletion src/grpc/dp_grpc_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int dp_recv_from_worker(struct dpgrpc_reply *reply, uint16_t request_type)
if (reply->type != request_type) {
DPGRPC_LOG_WARNING("Invalid response received", DP_LOG_GRPCREQUEST(request_type));
ret = DP_ERROR;
} else if (reply->is_chained || reply->msg_count != 1) {
} else if (reply->is_chained || reply->msg_count != 0) {
DPGRPC_LOG_WARNING("Single response expected, multiresponse received", DP_LOG_GRPCREQUEST(request_type));
ret = DP_ERROR;
}
Expand Down
2 changes: 1 addition & 1 deletion src/grpc/dp_grpc_responder.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ uint16_t dp_grpc_init_responder(struct dp_grpc_responder *responder, struct rte_
// by default, only one reply with one message
responder->rep_capacity = 1;
responder->msg_size = sizeof(struct dpgrpc_reply);
responder->rep_msgcount = 1;
responder->rep_msgcount = 0;
responder->rep = (struct dpgrpc_reply *)req_payload; // again, due to reusal of the request mbuf
responder->rep->type = responder->request.type;
responder->rep->is_chained = 0;
Expand Down
4 changes: 2 additions & 2 deletions test/grpc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ def getnatinfo(self, nat_vip, info_type):
if not output:
return None
specs = []
for match in re.finditer(r'(?:^|[\n\r]) *[0-9]+: min_port ([0-9]+), max_port ([0-9]+) --> Underlay IPv6 ([a-f0-9:]+)(?:$|[\n\r])', output):
specs.append({ 'natVIPIP': nat_vip, 'underlayRoute': match.group(3), 'minPort': int(match.group(1)), 'maxPort': int(match.group(2)) })
for match in re.finditer(r'(?:^|[\n\r]) *[0-9]+: min_port ([0-9]+), max_port ([0-9]+), vni ([0-9]+) --> Underlay IPv6 ([a-f0-9:]+)(?:$|[\n\r])', output):
specs.append({ 'natVIPIP': nat_vip, 'underlayRoute': match.group(4), 'minPort': int(match.group(1)), 'maxPort': int(match.group(2)) })
return specs

def addneighnat(self, nat_vip, vni, min_port, max_port, t_ipv6):
Expand Down

0 comments on commit 1a773f8

Please sign in to comment.