Page 5 of 5

Re: Websocket suite

Posted: Wed Apr 25, 2012 4:27 pm
by Siutsch
Thankz.

I will try it.

I am talking mainly about the necessary HTML code ...

Siutsch.

Re: Websocket suite

Posted: Wed May 23, 2012 3:50 pm
by wuffzack
Hi all,

I have found 2 serious bugs within the Websocket suite, and I believe I have fixed them. I just want to share my findings, so Pako can make this wonderful plugin even better.

Bug 1:
If there is an error during protocol negotiation, the server handler thread will run in a loop eating 100% of CPU time (or at least of one core).
Solution:
In line 3144 there is this statement:
if prot is not None: #CONNECT ?
In case prot *is* None, this code should be executed:

Code: Select all

                            else:
                                eg.PrintError('Websocket: prot is None! This is bad!')
                                del self.clientsServers[r]
                                self.inputs.remove(r)
                                r.close()
Bug 2:
If a client accidentally connects twice to the server and then disconnects, the plugin will crash badly. Eventghost needs to be restarted. This can happen in real life easily (moving out of range of a WLAN and entering again), but can be provoked by opening the websocket twice from a client.

line 3145 reads

Code: Select all

                                #Add client to list:
                                self.servers[ix][2].append(connection) 
                                self.connected.append(r)
which is wrong. IMHO it should be

Code: Select all

                                #Add client to list:
                                self.servers[ix][2].append(r) 
                                self.connected.append(r)
Otherwise the wrong socket is added to the list and havoc strikes as soon as a non existing socket tries to disconnect.
I don't understand the code well enough to be 100% sure, but these changes solved all reliability problems so far.

I hope this information is useful.
Many thanks to Pako for this incredibly useful plugin.

Re: Websocket suite

Posted: Sun Mar 10, 2013 12:31 pm
by Pastis
Wonderful plugin !!! thank you very much :D