@@ -141,13 +141,13 @@ int SFTP::startConnect(eio_req *req)
141141 }
142142 int res = ssh_connect (pthis->m_ssh_session );
143143 if (res != SSH_OK) {
144- fprintf (stderr, " connection failed\n " );
144+ // fprintf(stderr, "connection failed\n");
145145 snprintf (pthis->m_error , SFTP_MAX_ERROR,
146146 " Error connecting: %s\n " ,
147147 ssh_get_error (pthis->m_ssh_session ));
148148 return 0 ;
149149 }
150- fprintf (stderr, " after connection\n " );
150+ // fprintf(stderr, "after connection\n");
151151 // TODO: ssh_is_server_known() and warn the user if not...
152152
153153 // res = ssh_userauth_password(pthis->m_ssh_session, NULL, *password);
@@ -551,7 +551,7 @@ int SFTP::onStat(eio_req *req)
551551 Handle<Value> argv[2 ];
552552 // fprintf(stderr, pthis->m_error);
553553 argv[0 ] = String::New (pthis->m_error );
554- fprintf (stderr, " mstat: %p\n " , pthis->m_stat );
554+ // fprintf(stderr, "mstat: %p\n", pthis->m_stat);
555555 if (pthis->m_stat ) {
556556 argv[1 ] = BuildStatsObject (pthis->m_stat );
557557 }
@@ -669,6 +669,8 @@ inline void setOption(ssh_session& session, Local<Object>& obj,
669669 }
670670}
671671
672+
673+
672674Handle<Value> SFTP::init (const Arguments &args)
673675{
674676 HandleScope scope;
@@ -680,11 +682,12 @@ Handle<Value> SFTP::init(const Arguments &args)
680682 return False ();
681683
682684 Local<Object> opt = Local<Object>::Cast (args[0 ]);
685+ // TODO: free these!!!
683686 setOption (pthis->m_ssh_session , opt, " host" , SSH_OPTIONS_HOST);
684687 setOption (pthis->m_ssh_session , opt, " port" , SSH_OPTIONS_PORT_STR);
685688 setOption (pthis->m_ssh_session , opt, " user" , SSH_OPTIONS_USER);
686- ssh_options_set (pthis->m_ssh_session , SSH_OPTIONS_TIMEOUT, (void *) new long (1 ));
687- ssh_options_set (pthis->m_ssh_session , SSH_OPTIONS_LOG_VERBOSITY, (void *) new int (SSH_LOG_PACKET));
689+ ssh_options_set (pthis->m_ssh_session , SSH_OPTIONS_TIMEOUT, (void *) new long (10 ));
690+ // ssh_options_set(pthis->m_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, (void*) new int(SSH_LOG_PACKET));
688691 return True ();
689692}
690693
@@ -852,14 +855,14 @@ Handle<Value>SFTP::isConnected(const Arguments &args){
852855 HandleScope scope;
853856 SFTP *pthis = ObjectWrap::Unwrap<SFTP>(args.This ());
854857 int ret = ssh_is_connected (pthis->m_ssh_session );
855- fprintf (stdout, " isconnected: %d\n " , ret);
858+ // fprintf(stdout, "isconnected: %d\n", ret);
856859 return ret == 1 ? True () : False ();
857860}
858861
859862Handle<Value>SFTP::interrupt (const Arguments &args){
860863 HandleScope scope;
861864 SFTP *pthis = ObjectWrap::Unwrap<SFTP>(args.This ());
862- fprintf (stderr, " interrupt\n " );
865+ // fprintf(stderr, "interrupt\n");
863866 // ssh_disconnect(pthis->m_ssh_session);
864867 // ssh_silent_disconnect(pthis->m_ssh_session);
865868 ssh_set_fd_except (pthis->m_ssh_session );
0 commit comments