     getSession(httpRequest.connection, sessionId, (err, sessionContext) ->
       return throwError(err, httpResponse) if err
 
-      if sessionContext and (sessionContext.sessionId != sessionId or
-          sessionContext.lastActivity + sessionContext.timeout * 1000 < Date.now())
-        logger.accessError({message: 'Invalid session', sessionContext: sessionContext})
-        httpResponse.writeHead(400, {'Connection': 'close'})
-        httpResponse.end('Invalid session')
-        stats.concurrentRequests -= 1
-        return
-
-      # Check again just in case device included old session ID from the previous session
-      if not sessionContext and stats.concurrentRequests > MAX_CONCURRENT_REQUESTS
+      if sessionContext
+        sessionContext.httpRequest = httpRequest
+        sessionContext.httpResponse = httpResponse
+
+        if sessionContext.sessionId != sessionId or
+            sessionContext.lastActivity + sessionContext.timeout * 1000 < Date.now()
+          logger.accessError({message: 'Invalid session', sessionContext: sessionContext})
+          httpResponse.writeHead(400, {'Connection': 'close'})
+          httpResponse.end('Invalid session')
+          stats.concurrentRequests -= 1
+          return
+      else if stats.concurrentRequests > MAX_CONCURRENT_REQUESTS
+        # Check again just in case device included old session ID from the previous session
         httpResponse.writeHead(503, {'Retry-after': 60, 'Connection': 'close'})
         httpResponse.end('503 Service Unavailable')
         stats.droppedRequests += 1

      return parsedRpc(sessionContext, rpc, parseWarnings) if sessionContext

      if rpc.cpeRequest?.name isnt 'Inform'
        msg = {
          message: 'Invalid session'
          sessionContext: sessionContext or {}
        }
        msg.sessionContext.httpRequest = httpRequest
        msg.sessionContext.httpResponse = httpResponse
        logger.accessError(msg)
        httpResponse.writeHead(400, {'Connection': 'close'})
        httpResponse.end('Invalid session')
        stats.concurrentRequests -= 1

    )

    parsedRpc = (sessionContext, rpc, parseWarnings) ->
      for w in parseWarnings
        w.sessionContext = sessionContext
        w.rpc = rpc;
