Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[fix] ping_register: A client connection is created on first ping, bu…

…t in some case client can don't ping the server and some ressources can be allocated and never collected because we don't trigger Disconnect if client conenction is never created
  • Loading branch information...
commit 523cb664f6e3133cf57b8feca0c8043149f015e7 1 parent 267f125
@BourgerieQuentin BourgerieQuentin authored Thomas Refis committed
View
3  opabsl/mlbsl/bslPingRegister.ml
@@ -123,5 +123,8 @@ end
(** Instantiated ping register with opa scheduler and op client *)
module M = PingRegister.Make(PingScheduler)(Client)
+##register client_start : opa[ThreadContext.client] -> void
+let client_start ck = M.create (Obj.magic ck)
+
##register client_stop : opa[ThreadContext.client] -> void
let client_stop ck = M.delete (Obj.magic ck)
View
9 oparuntime/pingRegister.ml
@@ -352,7 +352,10 @@ module Make (S : SCHEDULER) (C : CLIENT) = struct
[event_key]. *)
val remove_event : event_key -> unit
- (** Delete connextion of a client. *)
+ (** Create connexion of a client. *)
+ val create : C.key -> unit
+
+ (** Delete connexion of a client. *)
val delete : C.key -> unit
(** Return [true] if the client connection identifier exists on
@@ -475,6 +478,8 @@ module Make (S : SCHEDULER) (C : CLIENT) = struct
| Not_found ->
Hashtbl.add state_tbl key (nb, s, ping_delay_client_msecond_rush)
+ let create key = update key 0
+
let find_delay key =
try
let (_, _, d) = Hashtbl.find state_tbl key in d
@@ -554,4 +559,6 @@ module Make (S : SCHEDULER) (C : CLIENT) = struct
let delete = Connection.delete
+ let create = Connection.create
+
end
View
3  oparuntime/pingRegister.mli
@@ -98,4 +98,7 @@ module Make (S : SCHEDULER) (C : CLIENT) : sig
(** Delete a client entry. *)
val delete : C.key -> unit
+ (** Create a client entry (Is needed ...). *)
+ val create : C.key -> unit
+
end
View
2  stdlib/core/web/resource/resource_private.opa
@@ -834,7 +834,7 @@ export_resource(external_css_files: list(string),
user_agent = get_request_ua(req)
uri = get_request_uri(req)
num_page = match thread_context().key with
- | ~{client}-> client.page
+ | ~{client}-> do %%BslPingRegister.client_start%%(client) client.page
| _ -> result = Random.int(max_int)
do Log.warning("Resource export",
"This page is exported from a context that doesn't have a valid client thread context. Replacing by random value {result}")
Please sign in to comment.
Something went wrong with that request. Please try again.