Add max metadata size option (#67)

This commit is contained in:
Travis Athougies 2018-07-27 08:41:18 -07:00 committed by intractable
parent 9c6b3f63b6
commit 991b389a16
3 changed files with 7 additions and 0 deletions

View file

@ -440,6 +440,8 @@ char* translate_arg_key(enum supported_arg_key key){
return GRPC_ARG_SECONDARY_USER_AGENT_STRING;
case max_receive_message_length_key:
return GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH;
case max_metadata_size_key:
return GRPC_ARG_MAX_METADATA_SIZE;
default:
return "unknown_arg_key";
}

View file

@ -156,6 +156,7 @@ enum supported_arg_key {
user_agent_prefix_key,
user_agent_suffix_key,
max_receive_message_length_key,
max_metadata_size_key,
};
grpc_arg* create_arg_array(size_t n);

View file

@ -52,6 +52,7 @@ data Arg = CompressionAlgArg CompressionAlgorithm
| UserAgentPrefix String
| UserAgentSuffix String
| MaxReceiveMessageLength Natural
| MaxMetadataSize Natural
deriving (Show, Eq)
{#fun create_string_arg as ^ {`GrpcArg', `Int', `ArgKey', `String'} -> `()'#}
@ -72,6 +73,9 @@ createArg array (UserAgentSuffix suffix) i =
createArg array (MaxReceiveMessageLength n) i =
createIntArg array i MaxReceiveMessageLengthKey $
fromIntegral (min n (fromIntegral (maxBound :: Int)))
createArg array (MaxMetadataSize n) i =
createIntArg array i MaxMetadataSizeKey $
fromIntegral (min n (fromIntegral (maxBound :: Int)))
createChannelArgs :: [Arg] -> IO GrpcChannelArgs
createChannelArgs args = do