@@ -69,7 +69,6 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
6969
7070    private  enum  ConnectionState :  Equatable  { 
7171        case  disconnected
72-         case  lostConnection
7372        case  connecting( [ ConnectionContinuation ] ) 
7473        case  connected( Channel ,  LambdaChannelHandler < LambdaRuntimeClient > ) 
7574
@@ -81,8 +80,6 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
8180                return  true 
8281            case  ( . connected,  . connected) : 
8382                return  true 
84-             case  ( . lostConnection,  . lostConnection) : 
85-                 return  true 
8683            default : 
8784                return  false 
8885            } 
@@ -171,21 +168,14 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
171168
172169            case  . connected( let  channel,  _) : 
173170                channel. close ( mode:  . all,  promise:  nil ) 
174- 
175-             case  . lostConnection: 
176-                 continuation. resume ( ) 
177171            } 
178172        } 
179173    } 
180174
181175    @usableFromInline  
182176    func  nextInvocation( )  async  throws  ->  ( Invocation ,  Writer )  { 
183177
184-         if  self . connectionState ==  . lostConnection { 
185-             throw  LambdaRuntimeError ( code:  . connectionToControlPlaneLost) 
186-         } 
187- 
188-         return  try await  withTaskCancellationHandler  { 
178+         try await  withTaskCancellationHandler  { 
189179            switch  self . lambdaState { 
190180            case  . idle: 
191181                self . lambdaState =  . waitingForNextInvocation
@@ -285,7 +275,7 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
285275
286276    private  func  channelClosed( _ channel:  any  Channel )  { 
287277        switch  ( self . connectionState,  self . closingState)  { 
288-         case  ( _,  . closed) ,   ( . lostConnection ,  _ ) : 
278+         case  ( _,  . closed) : 
289279            fatalError ( " Invalid state:  \( self . connectionState) ,  \( self . closingState) " ) 
290280
291281        case  ( . disconnected,  . notClosing) : 
@@ -345,9 +335,6 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
345335            return  loopBound. value
346336        case  . connected( _,  let  handler) : 
347337            return  handler
348- 
349-         case  . lostConnection: 
350-             throw  LambdaRuntimeError ( code:  . connectionToControlPlaneLost) 
351338        } 
352339
353340        let  bootstrap  =  ClientBootstrap ( group:  self . eventLoop) 
@@ -401,7 +388,7 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
401388
402389                    // close the channel
403390                    runtimeClient. channelClosed ( channel) 
404-                     runtimeClient. connectionState =  . lostConnection 
391+                     runtimeClient. connectionState =  . disconnected 
405392                } 
406393            } 
407394
@@ -418,9 +405,6 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
418405                    } 
419406                } 
420407                return  handler
421-             case  . lostConnection: 
422-                 // this should never happen
423-                 fatalError ( " Lost connection to Lambda service " ) 
424408            } 
425409        }  catch  { 
426410
@@ -436,9 +420,6 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
436420                    } 
437421                } 
438422                throw  error
439-             case  . lostConnection: 
440-                 // this should never happen
441-                 fatalError ( " Lost connection to Lambda service " ) 
442423            } 
443424        } 
444425    } 
@@ -475,10 +456,6 @@ extension LambdaRuntimeClient: LambdaChannelHandlerDelegate {
475456                } 
476457
477458                isolated. connectionState =  . disconnected
478- 
479-             case  . lostConnection: 
480-                 // this should never happen
481-                 fatalError ( " Lost connection to Lambda service " ) 
482459            } 
483460        } 
484461    } 
0 commit comments