diff options
author | 2015-02-09 10:56:25 -0800 | |
---|---|---|
committer | 2015-02-09 10:56:25 -0800 | |
commit | 484cd9ab1bc3a19b30ac92e850cbdd226de89910 (patch) | |
tree | db832831bb39f46451e8b42ae8d5c541cffa11d7 /src/node/ext/event.cc | |
parent | ee8f51fc8be1d48f98f57823523a9b36ee1edbba (diff) |
Updated event.cc with new changes
Diffstat (limited to 'src/node/ext/event.cc')
-rw-r--r-- | src/node/ext/event.cc | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/node/ext/event.cc b/src/node/ext/event.cc index b9446062d7..287599572a 100644 --- a/src/node/ext/event.cc +++ b/src/node/ext/event.cc @@ -58,11 +58,11 @@ using v8::Value; Handle<Value> ParseMetadata(grpc_metadata *metadata_elements, size_t length) { NanEscapableScope(); - std::map<char*, size_t> size_map; - std::map<char*, size_t> index_map; + std::map<const char*, size_t> size_map; + std::map<const char*, size_t> index_map; for (unsigned int i = 0; i < length; i++) { - char *key = metadata_elements[i].key; + const char *key = metadata_elements[i].key; if (size_map.count(key)) { size_map[key] += 1; } @@ -97,8 +97,6 @@ Handle<Value> GetEventData(grpc_event *event) { switch (event->type) { case GRPC_READ: return NanEscapeScope(ByteBufferToBuffer(event->data.read)); - case GRPC_INVOKE_ACCEPTED: - return NanEscapeScope(NanNew<Number>(event->data.invoke_accepted)); case GRPC_WRITE_ACCEPTED: return NanEscapeScope(NanNew<Number>(event->data.write_accepted)); case GRPC_FINISH_ACCEPTED: @@ -124,12 +122,12 @@ Handle<Value> GetEventData(grpc_event *event) { return NanEscapeScope(NanNull()); } rpc_new->Set( - NanNew<String, const char *>("method"), - NanNew<String, const char *>(event->data.server_rpc_new.method)); + NanNew("method"), + NanNew(event->data.server_rpc_new.method)); rpc_new->Set( - NanNew<String, const char *>("host"), - NanNew<String, const char *>(event->data.server_rpc_new.host)); - rpc_new->Set(NanNew<String, const char *>("absolute_deadline"), + NanNew("host"), + NanNew(event->data.server_rpc_new.host)); + rpc_new->Set(NanNew("absolute_deadline"), NanNew<Date>(TimespecToMilliseconds( event->data.server_rpc_new.deadline))); count = event->data.server_rpc_new.metadata_count; @@ -137,12 +135,11 @@ Handle<Value> GetEventData(grpc_event *event) { metadata = NanNew<Array>(static_cast<int>(count)); for (unsigned int i = 0; i < count; i++) { Handle<Object> item_obj = Object::New(); - item_obj->Set(NanNew<String, const char *>("key"), - NanNew<String, char *>(items[i].key)); + item_obj->Set(NanNew("key"), + NanNew(items[i].key)); item_obj->Set( - NanNew<String, const char *>("value"), - NanNew<String, char *>(items[i].value, - static_cast<int>(items[i].value_length))); + NanNew("value"), + NanNew(items[i].value, static_cast<int>(items[i].value_length))); metadata->Set(i, item_obj); } rpc_new->Set(NanNew("metadata"), ParseMetadata(items, count)); |