Browse Source

Rename some SecureStream methods

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
163485c8aa
  1. 20
      lib/net.js
  2. 36
      src/node_crypto.cc
  3. 12
      src/node_crypto.h

20
lib/net.js

@ -322,15 +322,15 @@ function setImplmentationMethods (self) {
assert(buf); assert(buf);
assert(self.secure); assert(self.secure);
var bytesWritten = self.secureStream.writeInject(buf, off, len); var bytesWritten = self.secureStream.clearIn(buf, off, len);
if (!securePool) { if (!securePool) {
allocNewSecurePool(); allocNewSecurePool();
} }
var secureLen = self.secureStream.writeExtract(securePool, var secureLen = self.secureStream.encOut(securePool,
0, 0,
securePool.length); securePool.length);
if (secureLen == -1) { if (secureLen == -1) {
// Check our read again for secure handshake // Check our read again for secure handshake
@ -363,15 +363,15 @@ function setImplmentationMethods (self) {
if (calledByIOWatcher) { if (calledByIOWatcher) {
secureBytesRead = oldRead(securePool, 0, securePool.length); secureBytesRead = oldRead(securePool, 0, securePool.length);
self.secureStream.readInject(securePool, 0, secureBytesRead); self.secureStream.encIn(securePool, 0, secureBytesRead);
} }
var chunkBytes; var chunkBytes;
do { do {
chunkBytes = chunkBytes =
self.secureStream.readExtract(pool, self.secureStream.clearOut(pool,
pool.used + bytesRead, pool.used + bytesRead,
pool.length - pool.used - bytesRead); pool.length - pool.used - bytesRead);
bytesRead += chunkBytes; bytesRead += chunkBytes;
} while ((chunkBytes > 0) && (pool.used + bytesRead < pool.length)); } while ((chunkBytes > 0) && (pool.used + bytesRead < pool.length));
@ -379,7 +379,7 @@ function setImplmentationMethods (self) {
return -1; return -1;
} }
if (self.secureStream.readPending()) { if (self.secureStream.clearPending()) {
process.nextTick(function () { process.nextTick(function () {
if (self._readWatcher) self._readWatcher.callback(); if (self._readWatcher) self._readWatcher.callback();
}); });
@ -426,7 +426,7 @@ function setImplmentationMethods (self) {
allocNewSecurePool(); allocNewSecurePool();
} }
var secureLen = self.secureStream.writeExtract( var secureLen = self.secureStream.encOut(
securePool, 0, securePool.length securePool, 0, securePool.length
); );

36
src/node_crypto.cc

@ -238,18 +238,18 @@ void SecureStream::Initialize(Handle<Object> target) {
t->InstanceTemplate()->SetInternalFieldCount(1); t->InstanceTemplate()->SetInternalFieldCount(1);
t->SetClassName(String::NewSymbol("SecureStream")); t->SetClassName(String::NewSymbol("SecureStream"));
NODE_SET_PROTOTYPE_METHOD(t, "readInject", NODE_SET_PROTOTYPE_METHOD(t, "encIn",
SecureStream::ReadInject); SecureStream::EncIn);
NODE_SET_PROTOTYPE_METHOD(t, "readExtract", NODE_SET_PROTOTYPE_METHOD(t, "clearOut",
SecureStream::ReadExtract); SecureStream::ClearOut);
NODE_SET_PROTOTYPE_METHOD(t, "writeInject", NODE_SET_PROTOTYPE_METHOD(t, "clearIn",
SecureStream::WriteInject); SecureStream::ClearIn);
NODE_SET_PROTOTYPE_METHOD(t, "writeExtract", NODE_SET_PROTOTYPE_METHOD(t, "encOut",
SecureStream::WriteExtract); SecureStream::EncOut);
NODE_SET_PROTOTYPE_METHOD(t, "readPending", NODE_SET_PROTOTYPE_METHOD(t, "clearPending",
SecureStream::ReadPending); SecureStream::ClearPending);
NODE_SET_PROTOTYPE_METHOD(t, "writeCanExtract", NODE_SET_PROTOTYPE_METHOD(t, "encPending",
SecureStream::WriteCanExtract); SecureStream::EncPending);
NODE_SET_PROTOTYPE_METHOD(t, "getPeerCertificate", NODE_SET_PROTOTYPE_METHOD(t, "getPeerCertificate",
SecureStream::GetPeerCertificate); SecureStream::GetPeerCertificate);
NODE_SET_PROTOTYPE_METHOD(t, "isInitFinished", NODE_SET_PROTOTYPE_METHOD(t, "isInitFinished",
@ -308,7 +308,7 @@ Handle<Value> SecureStream::New(const Arguments& args) {
} }
Handle<Value> SecureStream::ReadInject(const Arguments& args) { Handle<Value> SecureStream::EncIn(const Arguments& args) {
HandleScope scope; HandleScope scope;
SecureStream *ss = ObjectWrap::Unwrap<SecureStream>(args.Holder()); SecureStream *ss = ObjectWrap::Unwrap<SecureStream>(args.Holder());
@ -350,7 +350,7 @@ Handle<Value> SecureStream::ReadInject(const Arguments& args) {
} }
Handle<Value> SecureStream::ReadExtract(const Arguments& args) { Handle<Value> SecureStream::ClearOut(const Arguments& args) {
HandleScope scope; HandleScope scope;
SecureStream *ss = ObjectWrap::Unwrap<SecureStream>(args.Holder()); SecureStream *ss = ObjectWrap::Unwrap<SecureStream>(args.Holder());
@ -417,7 +417,7 @@ Handle<Value> SecureStream::ReadExtract(const Arguments& args) {
} }
Handle<Value> SecureStream::ReadPending(const Arguments& args) { Handle<Value> SecureStream::ClearPending(const Arguments& args) {
HandleScope scope; HandleScope scope;
SecureStream *ss = ObjectWrap::Unwrap<SecureStream>(args.Holder()); SecureStream *ss = ObjectWrap::Unwrap<SecureStream>(args.Holder());
@ -426,7 +426,7 @@ Handle<Value> SecureStream::ReadPending(const Arguments& args) {
} }
Handle<Value> SecureStream::WriteCanExtract(const Arguments& args) { Handle<Value> SecureStream::EncPending(const Arguments& args) {
HandleScope scope; HandleScope scope;
SecureStream *ss = ObjectWrap::Unwrap<SecureStream>(args.Holder()); SecureStream *ss = ObjectWrap::Unwrap<SecureStream>(args.Holder());
@ -435,7 +435,7 @@ Handle<Value> SecureStream::WriteCanExtract(const Arguments& args) {
} }
Handle<Value> SecureStream::WriteExtract(const Arguments& args) { Handle<Value> SecureStream::EncOut(const Arguments& args) {
HandleScope scope; HandleScope scope;
SecureStream *ss = ObjectWrap::Unwrap<SecureStream>(args.Holder()); SecureStream *ss = ObjectWrap::Unwrap<SecureStream>(args.Holder());
@ -472,7 +472,7 @@ Handle<Value> SecureStream::WriteExtract(const Arguments& args) {
} }
Handle<Value> SecureStream::WriteInject(const Arguments& args) { Handle<Value> SecureStream::ClearIn(const Arguments& args) {
HandleScope scope; HandleScope scope;
SecureStream *ss = ObjectWrap::Unwrap<SecureStream>(args.Holder()); SecureStream *ss = ObjectWrap::Unwrap<SecureStream>(args.Holder());

12
src/node_crypto.h

@ -51,12 +51,12 @@ class SecureStream : ObjectWrap {
protected: protected:
static v8::Handle<v8::Value> New(const v8::Arguments& args); static v8::Handle<v8::Value> New(const v8::Arguments& args);
static v8::Handle<v8::Value> ReadInject(const v8::Arguments& args); static v8::Handle<v8::Value> EncIn(const v8::Arguments& args);
static v8::Handle<v8::Value> ReadExtract(const v8::Arguments& args); static v8::Handle<v8::Value> ClearOut(const v8::Arguments& args);
static v8::Handle<v8::Value> ReadPending(const v8::Arguments& args); static v8::Handle<v8::Value> ClearPending(const v8::Arguments& args);
static v8::Handle<v8::Value> WriteCanExtract(const v8::Arguments& args); static v8::Handle<v8::Value> EncPending(const v8::Arguments& args);
static v8::Handle<v8::Value> WriteExtract(const v8::Arguments& args); static v8::Handle<v8::Value> EncOut(const v8::Arguments& args);
static v8::Handle<v8::Value> WriteInject(const v8::Arguments& args); static v8::Handle<v8::Value> ClearIn(const v8::Arguments& args);
static v8::Handle<v8::Value> GetPeerCertificate(const v8::Arguments& args); static v8::Handle<v8::Value> GetPeerCertificate(const v8::Arguments& args);
static v8::Handle<v8::Value> IsInitFinished(const v8::Arguments& args); static v8::Handle<v8::Value> IsInitFinished(const v8::Arguments& args);
static v8::Handle<v8::Value> VerifyPeer(const v8::Arguments& args); static v8::Handle<v8::Value> VerifyPeer(const v8::Arguments& args);

Loading…
Cancel
Save