Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/AppWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ void uWS_App_publish(const FunctionCallbackInfo<Value> &args) {

bool ok = app->publish(topic.getString(), message.getString(), args[2]->BooleanValue(isolate) ? uWS::OpCode::BINARY : uWS::OpCode::TEXT, args[3]->BooleanValue(isolate));

args.GetReturnValue().Set(Boolean::New(isolate, ok));
args.GetReturnValue().Set(ok);
}

template <typename APP>
Expand All @@ -668,7 +668,7 @@ void uWS_App_numSubscribers(const FunctionCallbackInfo<Value> &args) {
return;
}

args.GetReturnValue().Set(Integer::New(isolate, app->numSubscribers(topic.getString())));
args.GetReturnValue().Set((uint32_t) app->numSubscribers(topic.getString()));
}

/* This one modified per-thread static strings temporarily */
Expand Down Expand Up @@ -832,7 +832,7 @@ void uWS_App_getDescriptor(const FunctionCallbackInfo<Value> &args) {

//std::cout << "Loop: " << app->getLoop() << std::endl;

args.GetReturnValue().Set(Number::New(isolate, descriptor));
args.GetReturnValue().Set(descriptor);
}

template <typename APP>
Expand Down
8 changes: 4 additions & 4 deletions src/HttpResponseWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ struct HttpResponseWrapper {
if (res) {
unsigned int port = res->getRemotePort();

args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, port));
args.GetReturnValue().Set(port);
}
}

Expand Down Expand Up @@ -311,7 +311,7 @@ struct HttpResponseWrapper {
if (res) {
unsigned int port = res->getProxiedRemotePort();

args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, port));
args.GetReturnValue().Set(port);
}
}

Expand All @@ -333,7 +333,7 @@ struct HttpResponseWrapper {
Isolate *isolate = args.GetIsolate();
auto *res = getHttpResponse<SSL>(args);
if (res) {
args.GetReturnValue().Set(Number::New(isolate, getHttpResponse<SSL>(args)->getWriteOffset()));
args.GetReturnValue().Set((double) res->getWriteOffset());
}
}

Expand Down Expand Up @@ -473,7 +473,7 @@ struct HttpResponseWrapper {
assumeCorked();
bool ok = res->write(data.getString());

args.GetReturnValue().Set(Boolean::New(isolate, ok));
args.GetReturnValue().Set(ok);
}
}

Expand Down
22 changes: 11 additions & 11 deletions src/WebSocketWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct WebSocketWrapper {
return;
}
bool success = ws->subscribe(topic.getString());
args.GetReturnValue().Set(Boolean::New(isolate, success));
args.GetReturnValue().Set(success);
}
}

Expand All @@ -73,7 +73,7 @@ struct WebSocketWrapper {
return;
}
bool success = ws->unsubscribe(topic.getString());
args.GetReturnValue().Set(Boolean::New(isolate, success));
args.GetReturnValue().Set(success);
}
}

Expand All @@ -100,7 +100,7 @@ struct WebSocketWrapper {
}

bool success = ws->publish(topic.getString(), message.getString(), isBinary ? uWS::OpCode::BINARY : uWS::OpCode::TEXT, compress);
args.GetReturnValue().Set(Boolean::New(isolate, success));
args.GetReturnValue().Set(success);
}
}

Expand Down Expand Up @@ -169,7 +169,7 @@ struct WebSocketWrapper {
auto *ws = getWebSocket<SSL>(args);
if (ws) {
unsigned int port = ws->getRemotePort();
args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, port));
args.GetReturnValue().Set(port);
}
}

Expand All @@ -180,7 +180,7 @@ struct WebSocketWrapper {
auto *ws = getWebSocket<SSL>(args);
if (ws) {
unsigned int bufferedAmount = ws->getBufferedAmount();
args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, bufferedAmount));
args.GetReturnValue().Set(bufferedAmount);
}
}

Expand All @@ -197,7 +197,7 @@ struct WebSocketWrapper {

unsigned int sendStatus = ws->sendFirstFragment(message.getString(), args[1]->BooleanValue(isolate) ? uWS::OpCode::BINARY : uWS::OpCode::TEXT, args[2]->BooleanValue(isolate));

args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, sendStatus));
args.GetReturnValue().Set(sendStatus);
}
}

Expand All @@ -214,7 +214,7 @@ struct WebSocketWrapper {

unsigned int sendStatus = ws->sendFragment(message.getString(), args[1]->BooleanValue(isolate));

args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, sendStatus));
args.GetReturnValue().Set(sendStatus);
}
}

Expand All @@ -231,7 +231,7 @@ struct WebSocketWrapper {

unsigned int sendStatus = ws->sendLastFragment(message.getString(), args[1]->BooleanValue(isolate));

args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, sendStatus));
args.GetReturnValue().Set(sendStatus);
}
}

Expand All @@ -252,7 +252,7 @@ struct WebSocketWrapper {

unsigned int sendStatus = ws->send(message.getString(), isBinary ? uWS::OpCode::BINARY : uWS::OpCode::TEXT, compress);

args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, sendStatus));
args.GetReturnValue().Set(sendStatus);
}
}

Expand All @@ -269,7 +269,7 @@ struct WebSocketWrapper {

bool subscribed = ws->isSubscribed(topic.getString());

args.GetReturnValue().Set(Boolean::New(isolate, subscribed));
args.GetReturnValue().Set(subscribed);
}
}

Expand All @@ -287,7 +287,7 @@ struct WebSocketWrapper {
/* This is a wrapper that does not exist in the C++ project */
unsigned int sendStatus = ws->send(message.getString(), uWS::OpCode::PING);

args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, sendStatus));
args.GetReturnValue().Set(sendStatus);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void uWS_setTimeout(const FunctionCallbackInfo<Value> &args) {

//timerCallbacksJS[timer].Reset(args.GetIsolate(), Local<Function>::Cast(args[0]));

//args.GetReturnValue().Set(Integer::New(args.GetIsolate(), timer));
//args.GetReturnValue().Set(timer);
}

void uWS_clearTimeout(const FunctionCallbackInfo<Value> &args) {
Expand Down Expand Up @@ -185,7 +185,7 @@ void uWS_us_socket_local_port(const FunctionCallbackInfo<Value> &args) {
return;
}
int port = us_socket_local_port(0, (struct us_socket_t *) External::Cast(*args[0])->Value());
args.GetReturnValue().Set(Integer::New(args.GetIsolate(), port));
args.GetReturnValue().Set(port);
}

/* Temporary KV store (doesn't belong here) */
Expand Down Expand Up @@ -245,7 +245,7 @@ void uWS_getInteger(const FunctionCallbackInfo<Value> &args) {

uint32_t value = kvStoreInteger[std::string(collection.getString())][std::string(key.getString())];

args.GetReturnValue().Set(Integer::New(args.GetIsolate(), value));
args.GetReturnValue().Set(value);
}

void uWS_setInteger(const FunctionCallbackInfo<Value> &args) {
Expand Down Expand Up @@ -279,7 +279,7 @@ void uWS_incInteger(const FunctionCallbackInfo<Value> &args) {

uint32_t value = kvStoreInteger[std::string(collection.getString())][std::string(key.getString())] += change;

args.GetReturnValue().Set(Integer::New(args.GetIsolate(), value));
args.GetReturnValue().Set(value);
}

/* This one will spike memory usage for large stores */
Expand Down Expand Up @@ -337,7 +337,7 @@ void uWS_deleteString(const FunctionCallbackInfo<Value> &args) {

kvStoreString[std::string(collection.getString())].erase(std::string(key.getString()));

//args.GetReturnValue().Set(Integer::New(args.GetIsolate(), value));
//args.GetReturnValue().Set(value);
}

void uWS_deleteInteger(const FunctionCallbackInfo<Value> &args) {
Expand All @@ -354,7 +354,7 @@ void uWS_deleteInteger(const FunctionCallbackInfo<Value> &args) {

kvStoreInteger[std::string(collection.getString())].erase(std::string(key.getString()));

//args.GetReturnValue().Set(Integer::New(args.GetIsolate(), value));
//args.GetReturnValue().Set(value);
}

void uWS_deleteStringCollection(const FunctionCallbackInfo<Value> &args) {
Expand Down
Loading