Prechádzať zdrojové kódy

change xodr2rd5_grpc

yuchuli 2 rokov pred
rodič
commit
a06ca2980b

+ 8 - 4
src/test/carmakerwork/carmakerwork.cpp

@@ -57,11 +57,11 @@ void carmakerwork::threadwork()
 
 
     gpr_timespec timespec;
-    timespec.tv_sec = 10;//设置阻塞时间为2
+    timespec.tv_sec = 30;//设置阻塞时间为30
     timespec.tv_nsec = 0;
     timespec.clock_type = GPR_TIMESPAN;
 
-    int64_t interval = 100;
+    int64_t interval = 10;
 
     int64_t lastreq = 0;
 
@@ -78,11 +78,13 @@ void carmakerwork::threadwork()
 
         if(nRes == 0)
         {
+
             int64_t nnow = std::chrono::system_clock::now().time_since_epoch().count()/1000000;
             int64_t diff = static_cast<int64_t>(abs(nnow - lastreq)) ;
             if(diff<interval)
             {
-                std::this_thread::sleep_for(std::chrono::milliseconds(interval-diff));
+
+                  std::this_thread::sleep_for(std::chrono::milliseconds(interval-diff));
             }
         }
         iv::ipg::workReq request;
@@ -117,9 +119,11 @@ void carmakerwork::threadwork()
 
         lastreq = std::chrono::system_clock::now().time_since_epoch().count()/1000000;
 
+//        std::cout<<" convertwork. "<<std::endl;
         Status status = stub_->convertwork(&context, request, &reply);
         if (status.ok()) {
 
+ //           std::cout<<"result."<<std::endl;
             if(request.mnres() != 0)
             {
                 snprintf(strlog,256,"Complete workid:%lld nres:%d. uploaded to server.",request.workid(),request.mnres());
@@ -159,7 +163,7 @@ void carmakerwork::threadwork()
             snprintf(strlog,256,"RPC Fail. status code: %d error msg:%s",status.error_code(),status.error_message().data());
             Log(strlog);
 
-            if(status.error_code() == 4)
+            if((status.error_code() == 4) || (status.error_code() == 14))
             {
                 std::cout<<" RPC Exceed Time. Create New Stub_"<<std::endl;
                 channel = grpc::CreateCustomChannel(

+ 2 - 0
src/test/xodr2rd5_grpc/rd5route_grpc.pro

@@ -9,6 +9,8 @@ CONFIG -= app_bundle
 # deprecated API in order to know how to port your code away from it.
 DEFINES += QT_DEPRECATED_WARNINGS
 
+win32: DEFINES +=  _WIN32_WINNT=0x0602
+
 # You can also make your code fail to compile if you use deprecated APIs.
 # In order to do so, uncomment the following line.
 # You can also select to disable deprecated APIs only up to a certain version of Qt.

+ 2 - 0
src/test/xodr2rd5_grpc/xodr2rd5_grpc.pro

@@ -9,6 +9,8 @@ CONFIG -= app_bundle
 # deprecated API in order to know how to port your code away from it.
 DEFINES += QT_DEPRECATED_WARNINGS
 
+win32: DEFINES +=  _WIN32_WINNT=0x0602
+
 # You can also make your code fail to compile if you use deprecated APIs.
 # In order to do so, uncomment the following line.
 # You can also select to disable deprecated APIs only up to a certain version of Qt.