hellozedan / node-xmpp-bosh

Automatically exported from code.google.com/p/node-xmpp-bosh
0 stars 0 forks source link

Bug in lookup-service.js #20

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

It cannot be reproduced with the present implementation. So there is no bug as 
it is. The problem happens when the lookup-service is to be extended. 

What is the expected output? What do you see instead?

In lookup-service.js, the call to socket.emit('error', e) in the method 
give_up_trying_to_connect is not useful. It calls the 'error' event on the 
socket which is assigned a null value in the xmpp-proxy. 

The xmpp-proxy depeneds on the close event with a "had_error" parameter to 
communicate the error to the client. The call to this 'close' event will happen 
even without emitting the 'error' event on socket. The 'close' is pushed into 
the stack when the "connect" fails and as soon as the listeners are attached 
back to the socket, the listener of "close" is called with the "had_error" 
variable as true.

So, as of now this does not cause an issue, but if the lookup-service is to 
over-ride this behavior and fails at a different level than a socket connect 
error, there is no way to communicate this error condition back to the client. 

The lookup-service may have its own "events" which can be the contract rather 
than emitting the events of the sockets and the xmpp-proxy may rely on these 
events of the lookup-service. The idea is to allow lookup-service to 
communicate various errors back to the client.

Original issue reported on code.google.com by anup.kal...@gmail.com on 17 Aug 2011 at 5:30

GoogleCodeExporter commented 8 years ago
Dup of issue #21

Original comment by dhruvb...@gmail.com on 19 Aug 2011 at 4:27