Merge pull request #704 from pabigot/bugfix/file_descriptor_0

add pieces missed in pr #703
This commit is contained in:
Francis Gulotta 2016-03-29 14:46:39 -04:00
commit bffcf9efa9

View file

@ -211,7 +211,6 @@ function SerialPortFactory(_spfOptions) {
this.readable = true;
this.reading = false;
factory.SerialPortBinding.open(this.path, this.options, function (err, fd) {
self.fd = fd;
if (err) {
if (callback) {
callback(err);
@ -220,6 +219,7 @@ function SerialPortFactory(_spfOptions) {
}
return;
}
self.fd = fd;
if (process.platform !== 'win32') {
self.paused = false;
self.serialPoller = new factory.SerialPortBinding.SerialportPoller(self.fd, function (err) {
@ -345,7 +345,7 @@ function SerialPortFactory(_spfOptions) {
self.pool.used -= bytesRequested - bytesRead;
if (bytesRead === 0) {
if (self.fd >= 0) {
if (self.isOpen()) {
self.serialPoller.start();
}
} else {