Bug 61841

Summary: WebSocket: Call WebSocketChannel::fail() when WebSocketHandshake has failed
Product: WebKit Reporter: Yuta Kitamura <yutak>
Component: WebCore Misc.Assignee: Yuta Kitamura <yutak>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, commit-queue, tkent, ukai
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 61851    
Bug Blocks: 61115    
Attachments:
Description Flags
Patch none

Description Yuta Kitamura 2011-06-01 00:55:37 PDT
This is the last part of bug 61115.
Comment 1 Yuta Kitamura 2011-06-01 01:28:16 PDT
Created attachment 95561 [details]
Patch
Comment 2 Kent Tamura 2011-06-01 01:39:28 PDT
Comment on attachment 95561 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=95561&action=review

> Source/WebCore/websockets/WebSocketChannel.cpp:337
> -        if (!m_closed)
> -            m_handle->disconnect();
> +        fail(m_handshake.failureReason());

This looks a behavior change.
fail() calls m_handle->close(), not m_handle->disconnect(), right?
Comment 3 Yuta Kitamura 2011-06-01 02:39:46 PDT
Comment on attachment 95561 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=95561&action=review

>> Source/WebCore/websockets/WebSocketChannel.cpp:337
>> +        fail(m_handshake.failureReason());
> 
> This looks a behavior change.
> fail() calls m_handle->close(), not m_handle->disconnect(), right?

Good point.

This sounds like a bug of fail(), rather than of this patch. I should have used m_handle->disconnect() in fail(), because we don't have to wait for unsent data to be sent (difference between m_handle->close() and m_handle->disconnect() is that the former does not close the connection until the socket finishes to send all data while the latter immediately closes the connection).

I will create a new bug and fix this.
Comment 4 Yuta Kitamura 2011-06-01 20:09:15 PDT
Comment on attachment 95561 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=95561&action=review

>>> Source/WebCore/websockets/WebSocketChannel.cpp:337
>>> +        fail(m_handshake.failureReason());
>> 
>> This looks a behavior change.
>> fail() calls m_handle->close(), not m_handle->disconnect(), right?
> 
> Good point.
> 
> This sounds like a bug of fail(), rather than of this patch. I should have used m_handle->disconnect() in fail(), because we don't have to wait for unsent data to be sent (difference between m_handle->close() and m_handle->disconnect() is that the former does not close the connection until the socket finishes to send all data while the latter immediately closes the connection).
> 
> I will create a new bug and fix this.

Now m_handle->disconnect() is used in fail(), so this line is no longer a behavior change.
Comment 5 Kent Tamura 2011-06-01 20:15:30 PDT
Comment on attachment 95561 [details]
Patch

ok!
Comment 6 WebKit Commit Bot 2011-06-02 01:12:17 PDT
Comment on attachment 95561 [details]
Patch

Clearing flags on attachment: 95561

Committed r87883: <http://trac.webkit.org/changeset/87883>
Comment 7 WebKit Commit Bot 2011-06-02 01:12:22 PDT
All reviewed patches have been landed.  Closing bug.