Merge pull request #387 from brianc/issues/350

Ensure error being returned to native client
This commit is contained in:
Brian C 2013-07-08 05:52:25 -07:00
commit 9d773a29c2
2 changed files with 8 additions and 5 deletions

View File

@ -87,8 +87,7 @@ public:
TRACE("Received IO event");
if(status == -1) {
LOG("Connection error.");
return;
TRACE("Connection error. -1 status from lib_uv_poll");
}
Connection *connection = static_cast<Connection*>(w->data);

View File

@ -114,18 +114,22 @@ test('non-error calls supplied callback', function() {
});
test('when connecting to invalid host', function() {
return false;
var client = new Client({
user: 'aslkdjfsdf',
password: '1234',
host: 'asldkfjasdf!!#1308140.com'
});
assert.emits(client, 'error');
var delay = 5000;
var tid = setTimeout(function() {
assert(false, "When connecting to an invalid host the error event should be emitted but it has been " + delay + " and still no error event.");
}, delay);
client.on('error', function() {
clearTimeout(tid);
})
client.connect();
});
test('when connecting to invalid host with callback', function() {
return false;
var client = new Client({
user: 'brian',
password: '1234',