@@ -7,14 +7,14 @@ import Foundation
7
7
public class DIDCommAgent {
8
8
/// Enumeration representing the current state of the agent.
9
9
public enum State : String {
10
- case stoped
10
+ case stopped
11
11
case starting
12
12
case running
13
- case stoping
13
+ case stopping
14
14
}
15
15
16
16
/// Represents the current state of the agent.
17
- public private( set) var state = State . stoped
17
+ public private( set) var state = State . stopped
18
18
19
19
/// The mediator routing DID if one is currently registered.
20
20
public var mediatorRoutingDID : DID ? {
@@ -129,7 +129,7 @@ public class DIDCommAgent {
129
129
public func start( ) async throws {
130
130
guard
131
131
let connectionManager,
132
- state == . stoped
132
+ state == . stopped
133
133
else { return }
134
134
logger. info ( message: " Starting agent " )
135
135
state = . starting
@@ -149,19 +149,19 @@ public class DIDCommAgent {
149
149
150
150
/**
151
151
This function is used to stop the EdgeAgent.
152
- The function sets the state of EdgeAgent to .stoping .
152
+ The function sets the state of EdgeAgent to .stopping .
153
153
All ongoing events that was created by the EdgeAgent are stopped.
154
- After all the events are stopped the state of the EdgeAgent is set to .stoped .
154
+ After all the events are stopped the state of the EdgeAgent is set to .stopped .
155
155
156
156
- Throws: If the current state is not running throws error.
157
157
*/
158
158
public func stop( ) async throws {
159
159
guard state == . running else { return }
160
- logger. info ( message: " Stoping agent" )
161
- state = . stoping
160
+ logger. info ( message: " Stopping agent" )
161
+ state = . stopping
162
162
cancellables. forEach { $0. cancel ( ) }
163
163
connectionManager? . stopAllEvents ( )
164
- state = . stoped
164
+ state = . stopped
165
165
logger. info ( message: " Agent not running " )
166
166
}
167
167
}
0 commit comments