baalexander/node-portscanner — pull request #7 by EndangeredMassa (2013-10-11 22:15:59+00:00)
Title: Better timeout handling for checkPortStatus

I ran into an issue where the system resources on a dev machine were stretched and memcached took longer than 400ms to respond. If I waited for longer, it would successfully respond in this situation.

I think that the default timeout should be bumped to about 1000ms. It would also be nice if you could pass in an override value, but I didn't want to change the signature without asking how you'd prefer to see that done. I prefer that required params are params and options params are a object, like so:

```javascript
portscanner.checkPortStatus = function(port, options, callback) {
var host = options.host || 'localhost';
var timeout = options.timeout || 1000;
// ...
```

I also exposed the possible exceptions to the callback. I found this made debugging the issue much easier.