@@ -106,7 +106,7 @@ public Task DisposeAsync()
106106 private Task Unregister ( long registrationId )
107107 {
108108 UnregisterRequest unregisterRequest =
109- new UnregisterRequest ( mFormatter ) ;
109+ new UnregisterRequest ( mFormatter , registrationId ) ;
110110
111111 long requestId = mPendingUnregistrations . Add ( unregisterRequest ) ;
112112
@@ -119,17 +119,18 @@ private Task Unregister(long registrationId)
119119
120120 public void Unregistered ( long requestId )
121121 {
122-
123122 if ( mPendingUnregistrations . TryRemove ( requestId , out UnregisterRequest unregisterRequest ) )
124123 {
125- mRegistrations . TryRemove ( requestId , out IWampRpcOperation operation ) ;
124+ long registrationId = unregisterRequest . RegistrationId ;
125+
126+ mRegistrations . TryRemove ( registrationId , out IWampRpcOperation operation ) ;
126127
127128 lock ( mLock )
128129 {
129130
130- if ( mRegistrationsToInvocations . TryGetValue ( requestId , out SwapCollection < long > invocationsToRemove ) )
131+ if ( mRegistrationsToInvocations . TryGetValue ( registrationId , out SwapCollection < long > invocationsToRemove ) )
131132 {
132- mRegistrationsToInvocations . Remove ( requestId ) ;
133+ mRegistrationsToInvocations . Remove ( registrationId ) ;
133134
134135 foreach ( long invocationId in invocationsToRemove )
135136 {
@@ -296,8 +297,11 @@ public RegisterRequest(IWampRpcOperation operation, IWampFormatter<TMessage> for
296297
297298 private class UnregisterRequest : WampPendingRequest < TMessage >
298299 {
299- public UnregisterRequest ( IWampFormatter < TMessage > formatter ) : base ( formatter )
300+ public long RegistrationId { get ; }
301+
302+ public UnregisterRequest ( IWampFormatter < TMessage > formatter , long registrationId ) : base ( formatter )
300303 {
304+ RegistrationId = registrationId ;
301305 }
302306 }
303307
0 commit comments