Skip to content

Commit

Permalink
[feature] ping_register: Add a bypass that indicates the number of da…
Browse files Browse the repository at this point in the history
…ngling connection
  • Loading branch information
BourgerieQuentin authored and Thomas Refis committed Aug 1, 2011
1 parent 523cb66 commit 606eb78
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions opabsl/mlbsl/bslPingRegister.ml
Expand Up @@ -126,5 +126,8 @@ module M = PingRegister.Make(PingScheduler)(Client)
##register client_start : opa[ThreadContext.client] -> void
let client_start ck = M.create (Obj.magic ck)

##register nb_connection : -> int
let nb_connection = M.size

##register client_stop : opa[ThreadContext.client] -> void
let client_stop ck = M.delete (Obj.magic ck)
9 changes: 8 additions & 1 deletion oparuntime/pingRegister.ml
Expand Up @@ -376,6 +376,9 @@ module Make (S : SCHEDULER) (C : CLIENT) = struct
(** Broadcast the json message. *)
val broadcast : C.msg -> unit

(** Returns the number of connections. *)
val size : unit -> int

end = struct

type event_key = (C.key option * event * int)
Expand Down Expand Up @@ -532,9 +535,11 @@ module Make (S : SCHEDULER) (C : CLIENT) = struct
let broadcast mess =
#<If>
ping_debug "PING" "Broadcasting to clients"
#<End>;
#<End>;
iter (Entry.send mess)

let size () = Hashtbl.length state_tbl

end

type event_key = Connection.event_key
Expand All @@ -561,4 +566,6 @@ module Make (S : SCHEDULER) (C : CLIENT) = struct

let create = Connection.create

let size = Connection.size

end
3 changes: 3 additions & 0 deletions oparuntime/pingRegister.mli
Expand Up @@ -101,4 +101,7 @@ module Make (S : SCHEDULER) (C : CLIENT) : sig
(** Create a client entry (Is needed ...). *)
val create : C.key -> unit

(** Return the number of connections. *)
val size : unit -> int

end

0 comments on commit 606eb78

Please sign in to comment.