Adding peer checks and allows changing aes when query/retrieve

This commit is contained in:
Weiwei committed 2016-02-10 10:59:12 -06:00
1 parent 9cde04bcfe
commit 6172bf6440
2 files changed
+19 -16

No files matched your search

+5 -2
View File
@@ -111,8 +111,11 @@ Connection.prototype.addSocket = function(ae, socket) {
Connection.prototype.associate = function(options, callback) {
var hostAE = options.hostAE ? options.hostAE : this.defaultPeer,
sourceAE = options.sourceAE ? options.sourceAE : this.defaultServer;
peerInfo = this.selectPeer(hostAE), nativeSocket = new Socket();
if (!hostAE || !sourceAE) {
throw "Peers not provided or no defaults in settings";
}
var peerInfo = this.selectPeer(hostAE), nativeSocket = new Socket();
var socket = new CSocket(nativeSocket, this.options), o = this;
if (callback) {
socket.once('associated', callback);