From 0fc0c237d66917bdae097d1c215857984067aa17 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Fri, 22 Aug 2014 13:41:40 +0300 Subject: [PATCH 1/2] My take on a uid. --- src/async-wrap-inl.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/async-wrap-inl.h b/src/async-wrap-inl.h index 293eb174f1aa..cce928ac7cdb 100644 --- a/src/async-wrap-inl.h +++ b/src/async-wrap-inl.h @@ -68,6 +68,11 @@ inline AsyncWrap::AsyncWrap(Environment* env, v8::TryCatch try_catch; try_catch.SetVerbose(true); + // (refack) my twisted take on uid + char tmp_id[20]; + itoa((size_t)*object, tmp_id, 16); + object->Set(OneByteString(env->isolate(), "_uid"), OneByteString(env->isolate(), tmp_id)); + v8::Local val = object.As(); env->async_listener_run_function()->Call(env->process_object(), 1, &val); From 9cfde54cf5930c50438c1b98f3ee11ffd875127a Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Fri, 22 Aug 2014 13:42:44 +0300 Subject: [PATCH 2/2] IncomingMessage needs an id as well --- lib/_http_incoming.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js index ea92bfe7b3a8..ff21c2dc5ffa 100644 --- a/lib/_http_incoming.js +++ b/lib/_http_incoming.js @@ -43,6 +43,12 @@ function IncomingMessage(socket) { // When the parser emits body chunks, they go in this list. // _read() pulls them out, and when it finds EOF, it ends. + Object.defineProperty(this, "_id", { + enumerable: true, + configurable: false, + writable: false, + value: [Date.now().toString(16), process.pid.toString(16), process._uvContextId[0].toString(16)].join('_') + }); this.socket = socket; this.connection = socket;