Skip to content

Commit

Permalink
FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
chibenwa committed Apr 12, 2023
1 parent a284480 commit 6a70387
Showing 1 changed file with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,13 @@ private class ImapSession(client: => ImapAsyncClient, protocol: ImapProtocol) ex
val sniNames = null
val localAddress = null

val future: ImapFuture[ImapAsyncSessionImpl] = client
session = client
.createSession(uri, config, localAddress, sniNames, DebugMode.DEBUG_OFF, "ImapSession", ImapSession.sslContext)
.asInstanceOf[ImapFuture[ImapAsyncSessionImpl]]

future.setDoneCallback(s => {
session = s
context.become(connected)
sender() ! Response.Connected(ImapResponses.empty)
})
val errorCallback: Consumer[Exception] = e => {
logger.error(s"${getClass.getSimpleName} connection failed")
sender ! e
context.stop(self)
}

future.setExceptionCallback(errorCallback)
.get()
.getSession

context.become(connected)
sender() ! Response.Connected(ImapResponses.empty)
case Response.Disconnected(_) => ()
case Command.Disconnect(_) => ()
case msg =>
Expand Down Expand Up @@ -218,6 +208,7 @@ private class ImapSession(client: => ImapAsyncClient, protocol: ImapProtocol) ex
case Command.Disconnect(userId) =>
context.become(disconnected)
val responseCallback: Consumer[java.lang.Boolean] = _ => {
session = null
sender() ! Response.Disconnected(s"Disconnected command for ${userId.value}")
}
val future = session.close()
Expand Down

0 comments on commit 6a70387

Please sign in to comment.