mirror of
https://github.com/unclechu/gRPC-haskell.git
synced 2024-11-23 03:29:42 +01:00
Add max metadata size option (#67)
This commit is contained in:
parent
9c6b3f63b6
commit
991b389a16
3 changed files with 7 additions and 0 deletions
|
@ -440,6 +440,8 @@ char* translate_arg_key(enum supported_arg_key key){
|
||||||
return GRPC_ARG_SECONDARY_USER_AGENT_STRING;
|
return GRPC_ARG_SECONDARY_USER_AGENT_STRING;
|
||||||
case max_receive_message_length_key:
|
case max_receive_message_length_key:
|
||||||
return GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH;
|
return GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH;
|
||||||
|
case max_metadata_size_key:
|
||||||
|
return GRPC_ARG_MAX_METADATA_SIZE;
|
||||||
default:
|
default:
|
||||||
return "unknown_arg_key";
|
return "unknown_arg_key";
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,6 +156,7 @@ enum supported_arg_key {
|
||||||
user_agent_prefix_key,
|
user_agent_prefix_key,
|
||||||
user_agent_suffix_key,
|
user_agent_suffix_key,
|
||||||
max_receive_message_length_key,
|
max_receive_message_length_key,
|
||||||
|
max_metadata_size_key,
|
||||||
};
|
};
|
||||||
|
|
||||||
grpc_arg* create_arg_array(size_t n);
|
grpc_arg* create_arg_array(size_t n);
|
||||||
|
|
|
@ -52,6 +52,7 @@ data Arg = CompressionAlgArg CompressionAlgorithm
|
||||||
| UserAgentPrefix String
|
| UserAgentPrefix String
|
||||||
| UserAgentSuffix String
|
| UserAgentSuffix String
|
||||||
| MaxReceiveMessageLength Natural
|
| MaxReceiveMessageLength Natural
|
||||||
|
| MaxMetadataSize Natural
|
||||||
deriving (Show, Eq)
|
deriving (Show, Eq)
|
||||||
|
|
||||||
{#fun create_string_arg as ^ {`GrpcArg', `Int', `ArgKey', `String'} -> `()'#}
|
{#fun create_string_arg as ^ {`GrpcArg', `Int', `ArgKey', `String'} -> `()'#}
|
||||||
|
@ -72,6 +73,9 @@ createArg array (UserAgentSuffix suffix) i =
|
||||||
createArg array (MaxReceiveMessageLength n) i =
|
createArg array (MaxReceiveMessageLength n) i =
|
||||||
createIntArg array i MaxReceiveMessageLengthKey $
|
createIntArg array i MaxReceiveMessageLengthKey $
|
||||||
fromIntegral (min n (fromIntegral (maxBound :: Int)))
|
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 :: [Arg] -> IO GrpcChannelArgs
|
||||||
createChannelArgs args = do
|
createChannelArgs args = do
|
||||||
|
|
Loading…
Reference in a new issue