@openziti/ziti-sdk-nodejs 0.7.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2019-2020 Netfoundry, Inc.
2
+ Copyright Netfoundry, Inc.
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2019-2020 Netfoundry, Inc.
2
+ Copyright Netfoundry, Inc.
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2019-2020 Netfoundry, Inc.
2
+ Copyright Netfoundry, Inc.
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2019-2020 Netfoundry, Inc.
2
+ Copyright Netfoundry, Inc.
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/src/ziti_write.c CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2019-2020 Netfoundry, Inc.
2
+ Copyright Netfoundry, Inc.
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -32,6 +32,8 @@ typedef struct WriteItem {
32
32
  static void CallJs_on_write(napi_env env, napi_value js_cb, void* context, void* data) {
33
33
  napi_status status;
34
34
 
35
+ ZITI_NODEJS_LOG(DEBUG, "CallJs_on_write entered");
36
+
35
37
  // This parameter is not used.
36
38
  (void) context;
37
39
 
@@ -106,6 +108,8 @@ static void on_write(ziti_connection conn, ssize_t status, void *ctx) {
106
108
 
107
109
  ConnAddonData* addon_data = (ConnAddonData*) ziti_conn_data(conn);
108
110
 
111
+ ZITI_NODEJS_LOG(DEBUG, "on_write cb entered: addon_data: %p", addon_data);
112
+
109
113
  WriteItem* item = memset(malloc(sizeof(*item)), 0, sizeof(*item));
110
114
  item->conn = conn;
111
115
  item->status = status;
@@ -164,6 +168,8 @@ napi_value _ziti_write(napi_env env, const napi_callback_info info) {
164
168
 
165
169
  // Obtain ptr to JS 'write' callback function
166
170
  napi_value js_write_cb = args[2];
171
+ ZITI_NODEJS_LOG(DEBUG, "js_write_cb: %p", js_write_cb);
172
+
167
173
  napi_value work_name;
168
174
 
169
175
  // Create a string to describe this asynchronous operation.
@@ -195,7 +201,9 @@ napi_value _ziti_write(napi_env env, const napi_callback_info info) {
195
201
  }
196
202
 
197
203
  // Now, call the C-SDK to actually write the data over to the service
204
+ ZITI_NODEJS_LOG(DEBUG, "call ziti_write");
198
205
  ziti_write(conn, chunk, bufferLength, on_write, NULL);
206
+ ZITI_NODEJS_LOG(DEBUG, "back from ziti_write");
199
207
 
200
208
  return NULL;
201
209
  }
@@ -30,7 +30,9 @@ const Ziti_http_request = async (url, method, headers) => {
30
30
  // on_resp_data callback
31
31
  (obj) => {
32
32
  console.log('----------- Now inside Ziti_http_request on_resp_data callback ----------, obj is: \n%o', obj);
33
- console.log('----------- obj.body is: \n%o', obj.body.toString());
33
+ if (obj.body) {
34
+ console.log('----------- obj.body is: \n%o', obj.body.toString());
35
+ }
34
36
  },
35
37
  );
36
38
 
@@ -167,21 +169,21 @@ const sendChunk = (req) => {
167
169
  process.exit(-1);
168
170
  });
169
171
 
170
- console.log('inside JS main(), req is (%o)', req);
172
+ // console.log('inside JS main(), req is (%o)', req);
171
173
 
172
174
 
173
175
  // setTimeout( async () => {
174
176
 
175
- for (let i=0; i<3; i++ ) {
177
+ // for (let i=0; i<3; i++ ) {
176
178
 
177
- let req2 = await Ziti_http_request(url, method, []).catch((err) => {
178
- console.log('Ziti_http_request failed with error (%o)', err);
179
- process.exit(-1);
180
- });
179
+ // let req2 = await Ziti_http_request(url, method, []).catch((err) => {
180
+ // console.log('Ziti_http_request failed with error (%o)', err);
181
+ // process.exit(-1);
182
+ // });
181
183
 
182
- console.log('inside JS main() setTimeout(), req is (%o)', req2);
184
+ // console.log('inside JS main() setTimeout(), req is (%o)', req2);
183
185
 
184
- }
186
+ // }
185
187
 
186
188
  // }, 100);
187
189