mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-05-17 07:50:01 +00:00
- Add cover traffic support with constant rate as per spec - Add mix-user-message-limit and mix-disable-spam-protection CLI flags - Fix option_shims.nim double-evaluation bug causing UnpackDefect crash in ping (template expanded await expression twice, racing two calls) - Reduce default rate limit to 2 msgs/epoch for simulation testing - Add check_cover_traffic.sh metrics monitoring script Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
663 B
Nim
29 lines
663 B
Nim
# Compatibility shims for std/options
|
|
# The results library removed valueOr/withValue support for Option[T].
|
|
# These templates restore that functionality.
|
|
|
|
{.push raises: [].}
|
|
|
|
import std/options
|
|
|
|
template valueOr*[T](self: Option[T], def: untyped): T =
|
|
let tmp = self
|
|
if tmp.isSome():
|
|
tmp.get()
|
|
else:
|
|
def
|
|
|
|
template withValue*[T](self: Option[T], value, body: untyped): untyped =
|
|
let tmp = self
|
|
if tmp.isSome():
|
|
let value {.inject.} = tmp.get()
|
|
body
|
|
|
|
template withValue*[T](self: Option[T], value, body, elseBody: untyped): untyped =
|
|
let tmp = self
|
|
if tmp.isSome():
|
|
let value {.inject.} = tmp.get()
|
|
body
|
|
else:
|
|
elseBody
|