fix(core): 中继地址非法时立即返回原因
- start_relay 先校验信令地址,https:// 等暂不支持的形式直接报错,不再等到握手超时
This commit is contained in:
1 parent
ce41be002a
commit
d4d6ac695c
1 file changed
+3
@@ -462,6 +462,9 @@ pub fn start_relay(base_url: &str, peer_id: &str) -> Result<(), String> {
|
|||||||
{
|
{
|
||||||
return Err("已有直连会话,请先断开再切换到中继".to_string());
|
return Err("已有直连会话,请先断开再切换到中继".to_string());
|
||||||
}
|
}
|
||||||
|
// 地址不合法(例如当前还不支持 https://)时立刻回错,别让界面等到握手超时。
|
||||||
|
RelayChannel::new(base_url, "relay-probe", peer_id, RELAY_REQUEST_TIMEOUT)
|
||||||
|
.map_err(|error| error.to_string())?;
|
||||||
reset_session_state(&handle.shared);
|
reset_session_state(&handle.shared);
|
||||||
handle.shared.relay_running.store(true, Ordering::SeqCst);
|
handle.shared.relay_running.store(true, Ordering::SeqCst);
|
||||||
let shared = Arc::clone(&handle.shared);
|
let shared = Arc::clone(&handle.shared);
|
||||||
|
|||||||
Reference in new issue
Block a user