1
This commit is contained in:
parent
39b01b2794
commit
70e076631c
@ -38,19 +38,17 @@ void KcpSession::Init(int socket_handle, int secret_key_place)
|
|||||||
socket_handle_ = socket_handle;
|
socket_handle_ = socket_handle;
|
||||||
secret_key_ = App::Instance()->NewUuid();
|
secret_key_ = App::Instance()->NewUuid();
|
||||||
kcp_ = ikcp_create(socket_handle_, (void*)this);
|
kcp_ = ikcp_create(socket_handle_, (void*)this);
|
||||||
#if 1
|
|
||||||
const KcpConf& kcp_conf = JsonDataMgr::Instance()->GetKcpConf();
|
const KcpConf& kcp_conf = JsonDataMgr::Instance()->GetKcpConf();
|
||||||
ikcp_wndsize(kcp_, kcp_conf.sndwnd, kcp_conf.rcvwnd);
|
ikcp_wndsize(kcp_, kcp_conf.sndwnd, kcp_conf.rcvwnd);
|
||||||
ikcp_nodelay(kcp_, kcp_conf.nodelay, kcp_conf.interval, kcp_conf.resend, kcp_conf.nc);
|
ikcp_nodelay(kcp_, kcp_conf.nodelay, kcp_conf.interval, kcp_conf.resend, kcp_conf.nc);
|
||||||
kcp_->rx_minrto = kcp_conf.rx_minrto;
|
kcp_->rx_minrto = kcp_conf.rx_minrto;
|
||||||
kcp_->fastresend = kcp_conf.fastresend;
|
kcp_->fastresend = kcp_conf.fastresend;
|
||||||
#else
|
|
||||||
ikcp_wndsize(kcp_, 128, 128);
|
|
||||||
ikcp_nodelay(kcp_, 2, 10, 2, 1);
|
|
||||||
kcp_->rx_minrto = 10;
|
|
||||||
kcp_->fastresend = 1;
|
|
||||||
#endif
|
|
||||||
secret_key_place_ = secret_key_place;
|
secret_key_place_ = secret_key_place;
|
||||||
|
if (secret_key_place_ > 0) {
|
||||||
|
secret_key_place_ = 1;
|
||||||
|
} else if (secret_key_place_ < 0) {
|
||||||
|
secret_key_place_ = 0;
|
||||||
|
}
|
||||||
kcp_->output = UdpOutput;
|
kcp_->output = UdpOutput;
|
||||||
init_tick_ = a8::XGetTickCount();
|
init_tick_ = a8::XGetTickCount();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user