Merge pull request #24 from awakenetworks/upgrade-lib

update for grpc 0.14.0
This commit is contained in:
Joel Stanley 2016-06-13 09:21:31 -05:00
commit 1f9953911c
5 changed files with 15 additions and 2 deletions

View file

@ -385,3 +385,12 @@ char* call_details_get_host(grpc_call_details* details){
gpr_timespec* call_details_get_deadline(grpc_call_details* details){ gpr_timespec* call_details_get_deadline(grpc_call_details* details){
return &(details->deadline); return &(details->deadline);
} }
void* grpc_server_register_method_(grpc_server* server, const char* method,
const char* host){
//NOTE: grpc 0.14.0 added more params to this function. None of our code takes
//advantage of them, so we hardcode to the equivalent of 0.13.0's behavior.
return grpc_server_register_method(server, method, host,
GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER,
0);
}

View file

@ -133,4 +133,7 @@ char* call_details_get_host(grpc_call_details* details);
gpr_timespec* call_details_get_deadline(grpc_call_details* details); gpr_timespec* call_details_get_deadline(grpc_call_details* details);
void* grpc_server_register_method_(grpc_server* server, const char* method,
const char* host);
#endif //GRPC_HASKELL #endif //GRPC_HASKELL

View file

@ -173,6 +173,7 @@ clientRequest client@(Client{..}) rm@(RegisteredMethod{..})
grpcDebug "clientRequest(R): batch error." grpcDebug "clientRequest(R): batch error."
return $ Left x return $ Left x
Right rs' -> do Right rs' -> do
grpcDebug $ "clientRequest(R): got " ++ show rs'
return $ Right $ compileNormalRequestResults (rs ++ rs') return $ Right $ compileNormalRequestResults (rs ++ rs')
_ -> error "Streaming methods not yet implemented." _ -> error "Streaming methods not yet implemented."

View file

@ -222,7 +222,7 @@ castPeek p = peek (castPtr p)
{#fun grpc_server_create as ^ {#fun grpc_server_create as ^
{`ChannelArgsPtr',unReserved `Reserved'} -> `Server'#} {`ChannelArgsPtr',unReserved `Reserved'} -> `Server'#}
{#fun grpc_server_register_method as ^ {#fun grpc_server_register_method_ as ^
{`Server', `String', `String'} -> `CallHandle' CallHandle#} {`Server', `String', `String'} -> `CallHandle' CallHandle#}
{#fun grpc_server_register_completion_queue as ^ {#fun grpc_server_register_completion_queue as ^

View file

@ -59,7 +59,7 @@ testClientTimeoutNoServer =
clientOnlyTest "request timeout when server DNE" $ \c -> do clientOnlyTest "request timeout when server DNE" $ \c -> do
rm <- clientRegisterMethod c "/foo" Normal rm <- clientRegisterMethod c "/foo" Normal
r <- clientRequest c rm 1 "Hello" mempty r <- clientRequest c rm 1 "Hello" mempty
r @?= Left GRPCIOTimeout r @?= Left GRPCIOUnknownError
testServerCreateDestroy :: TestTree testServerCreateDestroy :: TestTree
testServerCreateDestroy = testServerCreateDestroy =