Permalink
Browse files

explicit mutex handling stubs

  • Loading branch information...
1 parent 54afe8e commit 9d35170dc4d3695e5cbc3a378ebf60e64eb747cb @substack committed Mar 25, 2011
Showing with 39 additions and 3 deletions.
  1. +2 −2 src/client.cc
  2. +36 −0 src/init.cc
  3. +1 −1 src/sshd.cc
View
@@ -21,9 +21,9 @@ Handle<Value> Client::New(const Arguments &args) {
Client::Client() {
session = ssh_new();
- Wrap(Persistent<Object>::New(
+ Wrap(
constructor_template->GetFunction()->NewInstance()
- ));
+ );
Ref();
}
View
@@ -1,6 +1,42 @@
#include "sshd.h"
+#include <libssh/callbacks.h>
+
+static int minit_cb (void **) {
+ printf("minit\n"); fflush(stdout);
+ return 0;
+}
+
+static int mdestroy_cb (void **) {
+ printf("mdestroy\n"); fflush(stdout);
+ return 0;
+}
+
+static int mlock_cb (void **) {
+ printf("mlock\n"); fflush(stdout);
+ return 0;
+}
+
+static int munlock_cb (void **) {
+ printf("munlock\n"); fflush(stdout);
+ return 0;
+}
+
+static unsigned long threads_id_cb (void) {
+ return 1;
+}
extern "C" void init(Handle<Object> target) {
+ ssh_threads_callbacks_struct *cbs = new ssh_threads_callbacks_struct;
+
+ cbs->mutex_init = minit_cb;
+ cbs->mutex_destroy = mdestroy_cb;
+ cbs->mutex_lock = mlock_cb;
+ cbs->mutex_unlock = munlock_cb;
+ cbs->thread_id = threads_id_cb;
+
+ ssh_threads_set_callbacks(cbs);
+ ssh_init();
+
HandleScope scope;
SSHD::Initialize(target);
}
View
@@ -181,8 +181,8 @@ printf("4\n"); fflush(stdout);
Handle<Value> argv[1];
argv[0] = client->handle_;
printf("5\n"); fflush(stdout);
- client->Ref();
printf("6\n"); fflush(stdout);
+printf("server = %x\n", server);
server->Emit(String::NewSymbol("session"), 1, argv);
printf("7\n"); fflush(stdout);

0 comments on commit 9d35170

Please sign in to comment.