Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't "connect" until setting up all connection-related information f…

…irst, including event handlers
  • Loading branch information...
commit eb51a634ff17b021367195ae2c2d147108389377 1 parent 6d15950
@mscdex authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  oscar.js
View
3  oscar.js
@@ -846,7 +846,7 @@ OscarConnection.prototype._resetState = function() {
OscarConnection.prototype._addConnection = function(id, services, host, port, cb) {
var self = this;
- self._state.connections[id] = net.createConnection(port, host);
+ self._state.connections[id] = new net.Socket();
self._state.connections[id].id = id;
self._state.connections[id].neededServices = services;
self._state.connections[id].serverType = (id === 'login' ? 'login' : 'BOS');
@@ -872,6 +872,7 @@ OscarConnection.prototype._addConnection = function(id, services, host, port, cb
self._state.connections[id].on('end', function() { end_handler.call(this, self); });
self._state.connections[id].on('error', function(err) { error_handler.call(this, self, err, cb); });
self._state.connections[id].on('close', function(had_error) { close_handler.call(this, self, had_error); });
+ self._state.connections[id].connect(port, host);
}
OscarConnection.prototype._addService = function(svc, roomInfo, cb) {
Please sign in to comment.
Something went wrong with that request. Please try again.