Skip to content

update socket.lua to check if connected #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lurenx
Copy link

@lurenx lurenx commented Sep 14, 2018

    connected,connecting = logger.isconnected()
    if  type(connected) ~= "nil" and type(connecting) ~= "nil"  then
        if not connected then
            create_error_response(1000,"server error")
        end
    end
    local bytes, err = logger.log(send_str)
    if err then
        ngx.log(ngx.ERR, "failed to log message: ", err)
        create_error_response(1000,"server error")
    end
    return

we can check the type and value of connected,connecting to response the client different http code if we dont want to lost log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant