anchor.diff:              return! (loop())}
           loop())
       do agent.Error.Add (log Fatal "Terminate execution due to unhandled exception in the AntiFloodMailboxProcessor. Exception was: %A")
  -    member this.post time buffers msg cont stop = agent.Post (time, buffers, msg, cont, stop)
  +    member this.post time rules msg cont stop = agent.Post (time, rules, msg, cont, stop)
   
   [<AllowNullLiteral>]
   type CustomProtocolSession() =
       inherit AppSession<CustomProtocolSession, BinaryRequestInfo>()
       let messageLogSize = 100
       let lastMessages   = Array.zeroCreate messageLogSize
  -    member val AntiFloodState  = new AntiFlood() with get
  -    member val AntiFloodRules  = []             with get, set
  -    member val Authenticated   = false          with get, set
  -    member val ProtocolVersion = (0, 0)         with get, set
  -    member val ClientVersion   = (0, 0)         with get, set
  -    member val MessageHash     = (-1, null)     with get, set
  +    member val AntiFloodState  = AntiFlood() with get
  +    member val AntiFloodRules  = []          with get, set
  +    member val Authenticated   = false       with get, set
  +    member val ProtocolVersion = 0, 0        with get, set
  +    member val ClientVersion   = 0, 0        with get, set
  +    member val MessageHash     = -1, null    with get, set
       member this.CheckMessageOrder msgId =
           let  v = lastMessages.[msgId % messageLogSize]
  -        if   v = msgId then log Warn "Duplicate message: %i - Session: %s" msgId this.SessionID ; false
  +        if   v = msgId then log Warn "Duplicate message: %i - Session: %s" msgId this.SessionID; false
           elif v > msgId then log Warn "New messageId: %i is too old compared with previous one: %i - Session: %s" msgId v this.SessionID; false
           else lastMessages.[msgId % messageLogSize] <- msgId; true
       override this.HandleException(e) =
           log Fatal "Unhandled exception in session: %s : %A " this.SessionID e
  -        this.Close(CloseReason.ApplicationError)
  +        this.Close CloseReason.ApplicationError
   
   type MyReceiveFilter (appServer,  appSession:CustomProtocolSession, remoteEndPoint) =
       inherit FixedHeaderReceiveFilter<BinaryRequestInfo> 6
       override this.GetBodyLengthFromHeader(header, offset, length) =
           if not (header.[offset] = 114uy) || not (header.[offset + 1] = 0uy) then
               log Warn "Invalid headers: %i - %i received from %A , session: %s . Client is %sauthenticated, will disconnect." header.[offset] header.[offset+1] remoteEndPoint appSession.SessionID (if appSession.Authenticated then "" else "not ")
  -            appSession.Close(CloseReason.ProtocolError)
  +            appSession.Close CloseReason.ProtocolError
               0
           else fromBytesWithOptions false (offset+2) header
       override this.ResolveRequestInfo(header, bodyBuffer, offset, length) = 
  
positive.code:     let mutable users = []
      let agent = MailboxProcessor.Start(fun inbox ->
          let rec loop() = async {
              let! (session, cmd) = inbox.Receive()
              users <-
                  match cmd, (tryFind (fun {Session = s} -> s == session) users) with
                  | LogOnOff  f, sender      -> f users sender
  
negative.code:     member this.CurrentQueueLength with get() = agent.CurrentQueueLength
      member this.post sessionID mbxmsg = agent.Post (sessionID, mbxmsg)
  
  type AntiFloodRule = {RuleId: string; Regex: Regex; Counter: Counter}
  
  type AntiFloodConfig() =
      inherit ConfigurationElement()
      let mutable regex = null
      [<ConfigurationProperty("id"        , IsKey = true , IsRequired = true)>] member this.Id         with get() = base.["id"        ] :?> _ and set(value:string) = base.["id"        ] <- value
      [<ConfigurationProperty("subject"   , IsKey = false, IsRequired = true)>] member this.Subject    with get() = base.["subject"   ] :?> _ and set(value:string) = base.["subject"   ] <- value
      [<ConfigurationProperty("time"      , IsKey = false, IsRequired = true)>] member this.Time       with get() = base.["time"      ] :?> _ and set(value:float ) = base.["time"      ] <- value
      [<ConfigurationProperty("maxRepeats", IsKey = false, IsRequired = true)>] member this.MaxRepeats with get() = base.["maxRepeats"] :?> _ and set(value:int   ) = base.["maxRepeats"] <- value
      [<ConfigurationProperty("match"     , IsKey = false, IsRequired = true)>] member this.Match      with get() = base.["match"     ] :?> _ and set(value:float ) = base.["match"     ] <- value
      member this.CreateRule() = 
          match regex with null -> regex <- Regex(Regex.Escape(this.Subject).Replace(@"\*", ".*").Replace(@"\?", "."), RegexOptions.Singleline ||| RegexOptions.Compiled) | _ -> ()
          {RuleId = this.Id; Regex = regex; Counter = Counter(this.MaxRepeats, this.Time, this.Match)}
  