Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 012c2fb

Browse files
committed
complexconnect verify default false
1 parent 7388b5b commit 012c2fb

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

mars/stn/proto/longlink_packer.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,5 @@ uint32_t longlink_noop_resp_cmdid() {return NOOP_CMDID;}
118118
uint32_t signal_keep_cmdid() {return SIGNALKEEP_CMDID;}
119119
void longlink_noop_req_body(AutoBuffer& _body) {}
120120
void longlink_noop_resp_body(AutoBuffer& _body) {}
121+
122+
bool longlink_complexconnect_need_verify() { return false; }

mars/stn/proto/longlink_packer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@ uint32_t signal_keep_cmdid();
4343
void longlink_noop_req_body(AutoBuffer& _body);
4444
void longlink_noop_resp_body(AutoBuffer& _body);
4545

46+
bool longlink_complexconnect_need_verify();
47+
4648
#endif // STN_SRC_LONGLINKPACKER_H_

mars/stn/src/longlink.cc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ class LongLinkConnectObserver : public MComplexConnect {
6464
connecting_index_[_index] = 1;
6565
}
6666
virtual void OnConnected(unsigned int _index, const socket_address& _addr, SOCKET _socket, int _error, int _rtt) {
67-
if (0 == _error)
68-
{}
69-
else {
67+
if (0 == _error) {
68+
if (!OnShouldVerify(_index, _addr)) {
69+
connecting_index_[_index] = 0;
70+
}
71+
} else {
7072
xwarn2(TSF"index:%_, connnet fail host:%_, iptype:%_", _index, ip_items_[_index].str_host, ip_items_[_index].source_type);
7173
xassert2(longlink_.fun_network_report_);
7274

@@ -76,7 +78,10 @@ class LongLinkConnectObserver : public MComplexConnect {
7678
}
7779
}
7880

79-
virtual bool OnShouldVerify(unsigned int _index, const socket_address& _addr) { return true;}
81+
virtual bool OnShouldVerify(unsigned int _index, const socket_address& _addr) {
82+
return longlink_complexconnect_need_verify();
83+
}
84+
8085
virtual bool OnVerifySend(unsigned int _index, const socket_address& _addr, SOCKET _socket, AutoBuffer& _buffer_send) {
8186
AutoBuffer body;
8287
longlink_noop_req_body(body);

0 commit comments

Comments
 (0)