Skip to content

Commit

Permalink
Rename win32ipc to dcrwin32ipc (#3828)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlyp authored Nov 17, 2022
1 parent 9341d54 commit 528b3d4
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ everything again.
The end result for module compilation should be the following files:

- `app/node_modules/blake-hash/bin/win32-x64-64/blake-hash.node`
- `app/node_modules/win32ipc/build/Release/win32ipc.node`
- `app/node_modules/dcrwin32ipc/build/Release/dcrwin32ipc.node`
- `app/node_modules/grpc/src/node/extension_binary/electron-v3.0-win32-x64/grpc_node.node`

*Note*: `yarn start` does _not_ currently correctly load the win32ipc module, so
*Note*: `yarn start` does _not_ currently correctly load the dcrwin32ipc module, so
testing with yarn build/start will fail to correctly unload dcrd/dcrwallet when
closing.

Expand Down
30 changes: 15 additions & 15 deletions app/main_dev/launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ export function closeDCRD() {
dcrdRequest = null;
} else if (isRunning(dcrdPID)) {
try {
const win32ipc = require("win32ipc/build/Release/win32ipc.node");
win32ipc.closePipe(dcrdPipeRx);
const dcrwin32ipc = require("dcrwin32ipc/build/Release/dcrwin32ipc.node");
dcrwin32ipc.closePipe(dcrdPipeRx);
dcrdPID = null;
dcrdRequest = null;
} catch (e) {
Expand All @@ -221,10 +221,10 @@ export const closeDCRW = () => {
process.kill(dcrwPID, "SIGINT");
} else if (isRunning(dcrwPID)) {
try {
const win32ipc = require("win32ipc/build/Release/win32ipc.node");
const dcrwin32ipc = require("dcrwin32ipc/build/Release/dcrwin32ipc.node");
dcrwTxStream.close();
win32ipc.closePipe(dcrwPipeTx);
win32ipc.closePipe(dcrwPipeRx);
dcrwin32ipc.closePipe(dcrwPipeTx);
dcrwin32ipc.closePipe(dcrwPipeRx);
} catch (e) {
logger.log("error", "Error closing dcrwallet piperx: " + e);
}
Expand All @@ -249,8 +249,8 @@ export const closeDcrlnd = () => {
dcrlndCreds = null;
} else if (isRunning(dcrlndPID)) {
try {
const win32ipc = require("win32ipc/build/Release/win32ipc.node");
win32ipc.closePipe(dcrlndPipeRx);
const dcrwin32ipc = require("dcrwin32ipc/build/Release/dcrwin32ipc.node");
dcrwin32ipc.closePipe(dcrlndPipeRx);
dcrlndPID = null;
dcrlndCreds = null;
} catch (e) {
Expand Down Expand Up @@ -398,8 +398,8 @@ export const launchDCRD = (reactIPC, testnet, appdata) =>

if (os.platform() == "win32") {
try {
const win32ipc = require("win32ipc/build/Release/win32ipc.node");
dcrdPipeRx = win32ipc.createPipe("out");
const dcrwin32ipc = require("dcrwin32ipc/build/Release/dcrwin32ipc.node");
dcrdPipeRx = dcrwin32ipc.createPipe("out");
args.push(format("--piperx=%d", dcrdPipeRx.readEnd));
} catch (e) {
logger.log("error", "can't find proper module to launch dcrd: " + e);
Expand Down Expand Up @@ -688,14 +688,14 @@ export const launchDCRWallet = async (

if (os.platform() == "win32") {
try {
const win32ipc = require("win32ipc/build/Release/win32ipc.node");
dcrwPipeRx = win32ipc.createPipe("out");
const dcrwin32ipc = require("dcrwin32ipc/build/Release/dcrwin32ipc.node");
dcrwPipeRx = dcrwin32ipc.createPipe("out");
args.push(format("--piperx=%d", dcrwPipeRx.readEnd));

dcrwPipeTx = win32ipc.createPipe("in");
dcrwPipeTx = dcrwin32ipc.createPipe("in");
args.push(format("--pipetx=%d", dcrwPipeTx.writeEnd));
args.push("--rpclistenerevents");
const pipeTxReadFd = win32ipc.getPipeEndFd(dcrwPipeTx.readEnd);
const pipeTxReadFd = dcrwin32ipc.getPipeEndFd(dcrwPipeTx.readEnd);
dcrwPipeTx.readEnd = -1; // -1 == INVALID_HANDLE_VALUE

dcrwTxStream = fs.createReadStream("", { fd: pipeTxReadFd });
Expand Down Expand Up @@ -851,8 +851,8 @@ export const launchDCRLnd = (

if (os.platform() == "win32") {
try {
const win32ipc = require("win32ipc/build/Release/win32ipc.node");
dcrlndPipeRx = win32ipc.createPipe("out");
const dcrwin32ipc = require("dcrwin32ipc/build/Release/dcrwin32ipc.node");
dcrlndPipeRx = dcrwin32ipc.createPipe("out");
args.push(format("--piperx=%d", dcrlndPipeRx.readEnd));
} catch (e) {
logger.log("error", "can't find proper module to launch dcrlnd: " + e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"targets": [
{
"target_name": "win32ipc",
"target_name": "dcrwin32ipc",
"sources": [],
"conditions": [
["OS=='win'", {"sources": ["module.cc", "pipe_wrapper.cc"]}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ void Init(v8::Local<v8::Object> exports) {
NODE_SET_METHOD(exports, "getPipeEndFd", GetPipeEndFd);
}

NODE_MODULE(win32ipc, Init)
NODE_MODULE(dcrwin32ipc, Init)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const childProcess = require("child_process");
const util = require("util");
const addon = require("./build/Release/win32ipc");
const addon = require("./build/Release/dcrwin32ipc");

const pipe = addon.createPipe("out");
console.log(pipe.readEnd, pipe.writeEnd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// with a wallet name "default-wallet".

const childProcess = require("child_process");
const addon = require("./build/Release/win32ipc");
const addon = require("./build/Release/dcrwin32ipc");
const path = require("path");
const os = require("os");
const fs = require("fs");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "win32ipc",
"name": "dcrwin32ipc",
"version": "0.1.0",
"description": "Wraps anonymous pipe creation on Windows",
"private": true,
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@
"optionalDependencies": {
"google-proto-files": "^2.5.0",
"grpc-tools": "^1.11.1",
"win32ipc": "./modules/win32ipc"
"dcrwin32ipc": "./modules/dcrwin32ipc"
},
"engines": {
"node": ">=14.16",
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4770,6 +4770,11 @@ data-urls@^2.0.0:
whatwg-mimetype "^2.3.0"
whatwg-url "^8.0.0"

dcrwin32ipc@./modules/dcrwin32ipc:
version "0.1.0"
dependencies:
bindings "~1.2.1"

debounce-fn@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/debounce-fn/-/debounce-fn-4.0.0.tgz#ed76d206d8a50e60de0dd66d494d82835ffe61c7"
Expand Down Expand Up @@ -13835,11 +13840,6 @@ wildcard@^2.0.0:
resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec"
integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==

win32ipc@./modules/win32ipc:
version "0.1.0"
dependencies:
bindings "~1.2.1"

word-wrap@^1.2.3, word-wrap@~1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
Expand Down

0 comments on commit 528b3d4

Please sign in to comment.