anchor.diff:              #state{wsstate=#ws_state{sock={ssl, Socket}}}=State) ->
       handle_frames(FirstPacket, State);
   
  +handle_info({ssl_error, _Socket, Error}, State) ->
  +    Info = io_lib:format("ssl_error ~p", [Error]),
  +    handle_abnormal_closure(State, iolist_to_binary(Info));
  +handle_info({tcp_error, _Socket, Error}, State) ->
  +    Info = io_lib:format("tcp_error ~p", [Error]),
  +    handle_abnormal_closure(State, iolist_to_binary(Info));
  +
   %% Abnormal socket closure: only if no Close frame was received or sent.
   handle_info({tcp_closed, Socket},
               #state{wsstate=#ws_state{sock=Socket}}=State) ->
  
positive.code:             end
      end.
  
  handle_abnormal_closure(#state{wsstate=WSState}=State) ->
      %% The only way we should get here is due to an abnormal close. Section
      %% 7.1.5 of RFC 6455 specifies 1006 as the connection close code for
      %% abnormal closure. It's also described in section 7.4.1.
      CloseStatus    = ?WS_STATUS_ABNORMAL_CLOSURE,
      ClosePayload   = <<CloseStatus:16/big>>,
      CloseWSState   = WSState#ws_state{sock=undefined,frag_type=none},
      CloseFrameInfo = #ws_frame_info{fin         = 1,
                                      rsv         = 0,
                                      opcode      = close,
                                      masked      = 0,
                                      masking_key = <<>>,
                                      length      = 2,
                                      payload     = ClosePayload,
                                      data        = ClosePayload,
                                      ws_state    = CloseWSState},
  
negative.code:         State#state.close_timer /= undefined ->
              {stop, normal, State};
          true ->
              handle_abnormal_closure(State, <<"tcp_closed">>)
      end;
  handle_info({ssl_closed, Socket},
              #state{wsstate=#ws_state{sock={ssl, Socket}}}=State) ->
  