Commit 1f1f6a0e authored by Victor's avatar Victor Committed by Julien Fontanet

fix: reset connection metadata on reconnection (#42)

parent db1e2114
...@@ -31,9 +31,6 @@ var SMB = (module.exports = function(opt) { ...@@ -31,9 +31,6 @@ var SMB = (module.exports = function(opt) {
// set default port // set default port
this.port = opt.port || port; this.port = opt.port || port;
// set message id
this.messageId = 0;
// extract share // extract share
this.share = matches[2]; this.share = matches[2];
...@@ -55,9 +52,6 @@ var SMB = (module.exports = function(opt) { ...@@ -55,9 +52,6 @@ var SMB = (module.exports = function(opt) {
this.username = opt.username; this.username = opt.username;
this.password = opt.password; this.password = opt.password;
// set session id
this.SessionId = Math.floor(Math.random() * 256) & 0xff;
// set the process id // set the process id
// https://msdn.microsoft.com/en-us/library/ff470100.aspx // https://msdn.microsoft.com/en-us/library/ff470100.aspx
this.ProcessId = Buffer.from([ this.ProcessId = Buffer.from([
......
...@@ -90,6 +90,12 @@ function connect(connection, cb) { ...@@ -90,6 +90,12 @@ function connect(connection, cb) {
cb = scheduleAutoClose(connection, cb); cb = scheduleAutoClose(connection, cb);
// set message id
connection.messageId = 0;
// set session id
connection.SessionId = Math.floor(Math.random() * 256) & 0xff;
// open TCP socket // open TCP socket
connection.socket.connect( connection.socket.connect(
connection.port, connection.port,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment