Lawouach/WebSocket-for-Python — pull request #64 by jodal (2012-11-26 23:46:35+00:00)
Title: Don't broadcast messages to terminated WebSockets

If a message is broadcasted through the CherryPy bus in the time interval
between a WebSocket is closed and it is cleaned out of WebSocketPlugin.pool, it
will cause and error in WebSocket.send:

``` python
Traceback (most recent call last):
File ".../ws4py/server/cherrypyserver.py", line 349, in broadcast
ws_handler.send(message, binary)
File ".../ws4py/websocket.py", line 167, in send
message_sender = self.stream.binary_message if binary else
self.stream.text_message
AttributeError: 'NoneType' object has no attribute 'text_message'
```

This patch checks if each WebSocket handler is terminated or not before trying
to send the broadcasted message, avoiding the above error.