Skip to content

Commit

Permalink
Merge pull request #9 from RealyUniqueName/fix-status
Browse files Browse the repository at this point in the history
Change connection state before invoking onopen()
  • Loading branch information
soywiz committed Oct 13, 2016
2 parents c4ddfa4 + 2b543c9 commit 27ff33a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/.idea
/.vscode
/*.iws
/*.ipr
/*.iml
/output
/target
*.zip
display-*.hxml
10 changes: 3 additions & 7 deletions src/haxe/net/impl/WebSocketGeneric.hx
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,8 @@ class WebSocketGeneric extends WebSocket {
if (!readHttpHeader()) {
return;
}

this.onopen();

state = State.Head;
state = State.Head;
this.onopen();
case State.ServerHandshake:
if (!readHttpHeader()) {
return;
Expand All @@ -132,10 +130,8 @@ class WebSocketGeneric extends WebSocket {
var handshake = prepareServerHandshake();
_debug('Sending responce: $handshake');
writeBytes(Bytes.ofString(handshake));

this.onopen();

state = State.Head;
this.onopen();
}
catch (e:String) {
writeBytes(Bytes.ofString(prepareHttp400(e)));
Expand Down

0 comments on commit 27ff33a

Please sign in to comment.