mirror of
https://github.com/signalapp/libsignal.git
synced 2024-09-20 03:52:17 +02:00
Quick-fix for the race between auth and unauth ws connectors
This commit is contained in:
parent
7af57ad1dd
commit
89547673af
@ -438,14 +438,19 @@ pub fn chat_service<T: TransportConnector + 'static>(
|
|||||||
incoming_tx: tokio::sync::mpsc::Sender<ServerEvent<T::Stream>>,
|
incoming_tx: tokio::sync::mpsc::Sender<ServerEvent<T::Stream>>,
|
||||||
auth: Auth,
|
auth: Auth,
|
||||||
) -> Chat<impl ChatServiceWithDebugInfo, impl ChatServiceWithDebugInfo> {
|
) -> Chat<impl ChatServiceWithDebugInfo, impl ChatServiceWithDebugInfo> {
|
||||||
let ws_service_connector = ChatOverWebSocketServiceConnector::new(
|
// Cannot reuse the same connector, since they lock on `incoming_tx` internally.
|
||||||
|
let unauth_ws_connector = ChatOverWebSocketServiceConnector::new(
|
||||||
|
WebSocketClientConnector::new(transport_connector.clone(), endpoint.config.clone()),
|
||||||
|
incoming_tx.clone(),
|
||||||
|
);
|
||||||
|
let auth_ws_connector = ChatOverWebSocketServiceConnector::new(
|
||||||
WebSocketClientConnector::new(transport_connector, endpoint.config.clone()),
|
WebSocketClientConnector::new(transport_connector, endpoint.config.clone()),
|
||||||
incoming_tx,
|
incoming_tx,
|
||||||
);
|
);
|
||||||
{
|
{
|
||||||
let auth_service =
|
let auth_service =
|
||||||
build_authorized_chat_service(&endpoint.manager, &ws_service_connector, auth);
|
build_authorized_chat_service(&endpoint.manager, &auth_ws_connector, auth);
|
||||||
let unauth_service = build_anonymous_chat_service(&endpoint.manager, &ws_service_connector);
|
let unauth_service = build_anonymous_chat_service(&endpoint.manager, &unauth_ws_connector);
|
||||||
Chat {
|
Chat {
|
||||||
auth_service,
|
auth_service,
|
||||||
unauth_service,
|
unauth_service,
|
||||||
|
Loading…
Reference in New Issue
Block a user