Skip to content

Commit bae24bc

Browse files
committed
Merge branch 'master' into dev
2 parents c89c452 + 57efd66 commit bae24bc

File tree

1 file changed

+69
-69
lines changed

1 file changed

+69
-69
lines changed

mars/sdt/jni/com_tencent_mars_sdt_SdtLogic_C2Java.cc

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -10,72 +10,72 @@
1010
// either express or implied. See the License for the specific language governing permissions and
1111
// limitations under the License.
1212

13-
/*
14-
* com_tencent_mars_sdt_SdtLogic_C2Java.cc
15-
*
16-
* Created on: 2016年8月9日
17-
* Author: caoshaokun
18-
*/
19-
20-
#include <jni.h>
21-
#include <vector>
22-
#include <sstream>
23-
24-
#include "mars/comm/autobuffer.h"
25-
#include "mars/comm/xlogger/xlogger.h"
26-
#include "mars/comm/jni/util/var_cache.h"
27-
#include "mars/comm/jni/util/scope_jenv.h"
28-
#include "mars/comm/jni/util/comm_function.h"
29-
#include "mars/comm/jni/util/scoped_jstring.h"
30-
#include "mars/comm/compiler_util.h"
31-
#include "mars/sdt/sdt.h"
32-
#include "mars/sdt/netchecker_profile.h"
33-
34-
DEFINE_FIND_CLASS(KC2Java, "com/tencent/mars/sdt/SdtLogic")
35-
36-
namespace mars {
37-
namespace sdt {
38-
39-
DEFINE_FIND_STATIC_METHOD(KC2Java_reportSignalDetectResults, KC2Java, "reportSignalDetectResults", "(Ljava/lang/String;)V")
40-
WEAK_FUNC void ReportNetCheckResult(std::vector<CheckResultProfile>& _check_results) {
41-
xverbose_function();
42-
43-
VarCache* cache_instance = VarCache::Singleton();
44-
ScopeJEnv scope_jenv(cache_instance->GetJvm());
45-
JNIEnv *env = scope_jenv.GetEnv();
46-
47-
std::stringstream check_results_str;
48-
check_results_str << "{";
49-
check_results_str << "\"details\":[";
50-
std::vector<CheckResultProfile>::const_iterator iter = _check_results.begin();
51-
for (; iter != _check_results.end();) {
52-
check_results_str << "{";
53-
check_results_str << "\"detectType\":" << iter->netcheck_type;
54-
check_results_str << ",\"errorCode\":" << iter->error_code;
55-
check_results_str << ",\"networkType\":" << iter->network_type;
56-
check_results_str << ",\"detectIP\":\"" << iter->ip << "\"";
57-
check_results_str << ",\"port\":" << iter->port;
58-
check_results_str << ",\"conntime\":" << iter->conntime;
59-
check_results_str << ",\"rtt\":" << iter->rtt;
60-
check_results_str << ",\"rttStr\":\"" << iter->rtt_str << "\"";
61-
check_results_str << ",\"httpStatusCode\":" << iter->status_code;
62-
check_results_str << ",\"pingCheckCount\":" << iter->checkcount;
63-
check_results_str << ",\"pingLossRate\":\"" << iter->loss_rate << "\"";
64-
check_results_str << ",\"dnsDomain\":\"" << iter->domain_name << "\"";
65-
check_results_str << ",\"localDns\":\"" << iter->local_dns << "\"";
66-
check_results_str << ",\"dnsIP1\":\"" << iter->ip1 << "\"";
67-
check_results_str << ",\"dnsIP2\":\"" << iter->ip2 << "\"";
68-
check_results_str << "}";
69-
if (++iter != _check_results.end()) {
70-
check_results_str << ",";
71-
}
72-
else {
73-
break;
74-
}
75-
}
76-
check_results_str << "]}";
77-
78-
JNU_CallStaticMethodByMethodInfo(env, KC2Java_reportSignalDetectResults, ScopedJstring(env, check_results_str.str().c_str()).GetJstr());
79-
}
80-
81-
}}
13+
/*
14+
* com_tencent_mars_sdt_SdtLogic_C2Java.cc
15+
*
16+
* Created on: 2016年8月9日
17+
* Author: caoshaokun
18+
*/
19+
20+
#include <jni.h>
21+
#include <vector>
22+
#include <sstream>
23+
24+
#include "mars/comm/autobuffer.h"
25+
#include "mars/comm/xlogger/xlogger.h"
26+
#include "mars/comm/jni/util/var_cache.h"
27+
#include "mars/comm/jni/util/scope_jenv.h"
28+
#include "mars/comm/jni/util/comm_function.h"
29+
#include "mars/comm/jni/util/scoped_jstring.h"
30+
#include "mars/comm/compiler_util.h"
31+
#include "mars/sdt/sdt.h"
32+
#include "mars/sdt/netchecker_profile.h"
33+
34+
DEFINE_FIND_CLASS(KC2Java, "com/tencent/mars/sdt/SdtLogic")
35+
36+
namespace mars {
37+
namespace sdt {
38+
39+
DEFINE_FIND_STATIC_METHOD(KC2Java_reportSignalDetectResults, KC2Java, "reportSignalDetectResults", "(Ljava/lang/String;)V")
40+
WEAK_FUNC void ReportNetCheckResult(std::vector<CheckResultProfile>& _check_results) {
41+
xverbose_function();
42+
43+
VarCache* cache_instance = VarCache::Singleton();
44+
ScopeJEnv scope_jenv(cache_instance->GetJvm());
45+
JNIEnv *env = scope_jenv.GetEnv();
46+
47+
std::stringstream check_results_str;
48+
check_results_str << "{";
49+
check_results_str << "\"details\":[";
50+
std::vector<CheckResultProfile>::const_iterator iter = _check_results.begin();
51+
for (; iter != _check_results.end();) {
52+
check_results_str << "{";
53+
check_results_str << "\"detectType\":" << iter->netcheck_type;
54+
check_results_str << ",\"errorCode\":" << iter->error_code;
55+
check_results_str << ",\"networkType\":" << iter->network_type;
56+
check_results_str << ",\"detectIP\":\"" << iter->ip << "\"";
57+
check_results_str << ",\"port\":" << iter->port;
58+
check_results_str << ",\"conntime\":" << iter->conntime;
59+
check_results_str << ",\"rtt\":" << iter->rtt;
60+
check_results_str << ",\"rttStr\":\"" << iter->rtt_str << "\"";
61+
check_results_str << ",\"httpStatusCode\":" << iter->status_code;
62+
check_results_str << ",\"pingCheckCount\":" << iter->checkcount;
63+
check_results_str << ",\"pingLossRate\":\"" << iter->loss_rate << "\"";
64+
check_results_str << ",\"dnsDomain\":\"" << iter->domain_name << "\"";
65+
check_results_str << ",\"localDns\":\"" << iter->local_dns << "\"";
66+
check_results_str << ",\"dnsIP1\":\"" << iter->ip1 << "\"";
67+
check_results_str << ",\"dnsIP2\":\"" << iter->ip2 << "\"";
68+
check_results_str << "}";
69+
if (++iter != _check_results.end()) {
70+
check_results_str << ",";
71+
}
72+
else {
73+
break;
74+
}
75+
}
76+
check_results_str << "]}";
77+
78+
JNU_CallStaticMethodByMethodInfo(env, KC2Java_reportSignalDetectResults, ScopedJstring(env, check_results_str.str().c_str()).GetJstr());
79+
}
80+
81+
}}

0 commit comments

Comments
 (0)