@@ -5,7 +5,7 @@ use super::{
55 dialog_layer:: DialogLayer ,
66} ;
77use crate :: {
8- dialog:: { dialog:: Dialog , dialog_layer :: DialogLayerInnerRef , DialogId } ,
8+ dialog:: { dialog:: Dialog , DialogId } ,
99 transaction:: {
1010 key:: { TransactionKey , TransactionRole } ,
1111 make_tag,
@@ -19,7 +19,7 @@ use rsip::{
1919 Request , Response ,
2020} ;
2121use std:: sync:: Arc ;
22- use tracing:: { debug, info, warn } ;
22+ use tracing:: { debug, info} ;
2323
2424/// INVITE Request Options
2525///
@@ -134,64 +134,6 @@ pub struct InviteOption {
134134 pub headers : Option < Vec < rsip:: Header > > ,
135135}
136136
137- pub struct DialogGuard {
138- pub dialog_layer_inner : DialogLayerInnerRef ,
139- pub id : DialogId ,
140- }
141-
142- impl DialogGuard {
143- pub fn new ( dialog_layer : & Arc < DialogLayer > , id : DialogId ) -> Self {
144- Self {
145- dialog_layer_inner : dialog_layer. inner . clone ( ) ,
146- id,
147- }
148- }
149- }
150-
151- impl Drop for DialogGuard {
152- fn drop ( & mut self ) {
153- let dlg = match self . dialog_layer_inner . dialogs . write ( ) {
154- Ok ( mut dialogs) => match dialogs. remove ( & self . id ) {
155- Some ( dlg) => dlg,
156- None => return ,
157- } ,
158- _ => return ,
159- } ;
160- let _ = tokio:: spawn ( async move {
161- if let Err ( e) = dlg. hangup ( ) . await {
162- info ! ( id=%dlg. id( ) , "failed to hangup dialog: {}" , e) ;
163- }
164- } ) ;
165- }
166- }
167-
168- pub ( super ) struct DialogGuardForUnconfirmed < ' a > {
169- pub dialog_layer_inner : & ' a DialogLayerInnerRef ,
170- pub id : & ' a DialogId ,
171- }
172-
173- impl < ' a > Drop for DialogGuardForUnconfirmed < ' a > {
174- fn drop ( & mut self ) {
175- // If the dialog is still unconfirmed, we should try to cancel it
176- match self . dialog_layer_inner . dialogs . write ( ) {
177- Ok ( mut dialogs) => match dialogs. remove ( self . id ) {
178- Some ( dlg) => {
179- info ! ( %self . id, "unconfirmed dialog dropped, cancelling it" ) ;
180- let _ = tokio:: spawn ( async move {
181- if let Err ( e) = dlg. hangup ( ) . await {
182- info ! ( id=%dlg. id( ) , "failed to hangup unconfirmed dialog: {}" , e) ;
183- }
184- } ) ;
185- }
186- None => { }
187- } ,
188- Err ( e) => {
189- warn ! ( %self . id, "failed to acquire write lock on dialogs: {}" , e) ;
190- }
191- }
192- }
193- }
194-
195137impl DialogLayer {
196138 /// Create an INVITE request from options
197139 ///
@@ -396,12 +338,6 @@ impl DialogLayer {
396338 . unwrap ( )
397339 . insert ( id. clone ( ) , Dialog :: ClientInvite ( dialog. clone ( ) ) ) ;
398340 info ! ( %id, "client invite dialog created" ) ;
399-
400- let _guard = DialogGuardForUnconfirmed {
401- dialog_layer_inner : & self . inner ,
402- id : & id,
403- } ;
404-
405341 match dialog. process_invite ( tx) . await {
406342 Ok ( ( new_dialog_id, resp) ) => {
407343 debug ! (
0 commit comments