Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(841)

Unified Diff: content/browser/renderer_host/socket_stream_dispatcher_host.cc

Issue 10458057: Websocket should fire 'error' event if no server available (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/socket_stream_dispatcher_host.cc
diff --git a/content/browser/renderer_host/socket_stream_dispatcher_host.cc b/content/browser/renderer_host/socket_stream_dispatcher_host.cc
index 84e5c8e8a98abd7bf575dcfcc1e7c693eb1f1f8b..965cda534b7231c8755db47d64621bd3dc47ae69 100644
--- a/content/browser/renderer_host/socket_stream_dispatcher_host.cc
+++ b/content/browser/renderer_host/socket_stream_dispatcher_host.cc
@@ -99,6 +99,19 @@ void SocketStreamDispatcherHost::OnClose(net::SocketStream* socket) {
DeleteSocketStreamHost(socket_id);
}
+void SocketStreamDispatcherHost::OnError(
+ const net::SocketStream* socket, int error) {
Yuta Kitamura 2012/06/11 08:24:16 Function arguments should usually be placed in dif
+ int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket);
+ DVLOG(1) << "SocketStreamDispatcherHost::OnError socket_id=" << socket_id;
+ if (socket_id == content::kNoSocketId) {
+ LOG(ERROR) << "NoSocketId in OnError";
+ return;
+ }
+ if (!Send(new SocketStreamMsg_Failed(socket_id, error))) {
Yuta Kitamura 2012/06/11 08:24:16 I suggest getting a reason message for |error| her
Li Yin 2012/06/12 08:54:20 Sending the error message sounds a good idea. Mayb
Yuta Kitamura 2012/06/12 09:49:54 Yeah, it's perhaps better to do conversion after I
+ LOG(ERROR) << "SocketStreamMsg_Failed failed.";
+ }
+}
+
void SocketStreamDispatcherHost::OnSSLCertificateError(
net::SocketStream* socket, const net::SSLInfo& ssl_info, bool fatal) {
int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket);

Powered by Google App Engine
This is Rietveld 408576698