I have the following situation:
Upon initialitation (actually first receive) of a socket I want to check something in the handshake (TLS), this has to be only checked upon connection initialization and not on every further receive.
Currently I have an odd:
// this is happening outer scope var somethingThatGetsComputedinInit = 0 def receive { if (init) { somethingThatGetsComputedinInit = doinitstuff(StuffIOnlyGetInitially) init = false } } Although it would work, this smells so imperative and ugly. What would be a purely functional solution to this?
somethingThatGetsComputedinInitpersistent between calls? I that case you could usesomethingThatGetsComputedinInit == 0