localserver: fix kryptoecmiddlware race (#2772)