Skip to content

Commit 7e1e71f

Browse files
author
krizsa
committed
some cleanups
1 parent 4f46bcc commit 7e1e71f

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/sftp.cc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
672674
Handle<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

859862
Handle<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);

src/sftp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class SFTP : EventEmitter {
3131
sftp_file m_sftp_file;
3232
ssh_string m_pub_key;
3333
ssh_private_key m_prv_key;
34+
long m_timeout;
3435
int m_done;
3536
char* m_error;
3637
ListNode* m_list;

0 commit comments

Comments
 (0)