Skip to content
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

Create a general solution for xmpp_conn_handler error code responses #123

Open
matisszilard opened this issue Apr 10, 2018 · 0 comments
Open

Comments

@matisszilard
Copy link

Description

The xmpp_conn_handler function is notified when a connection related event occurred.

typedef void (*xmpp_conn_handler)(xmpp_conn_t * const conn, 
				  const xmpp_conn_event_t event,
				  const int error,
				  xmpp_stream_error_t * const stream_error,
				  void * const userdata);

There are some cases, when the error code or the stream_error parameters are not set.
Ex.: there is an authentication error (source file), or a socket error (source file).

In some cases the error code is set properly. Ex.: tls error (source code), connection abort error etc.

Possible solution

Create an enum with the possible error codes / events and set as the connection struct error parameter. The user application can decide how to handle the given situation.

Example.:

enum StropheErrorCode {
    NO_ERROR = 0,
    AUTHENTICATION_FAILURE = 1,
    CONNECTION_TIMEOUT = 2,
    TLS_ERROR = 3,
    CONNECTION_FAIL = 4
    ...
};

Connected issue:

#122

pasis added a commit that referenced this issue Sep 15, 2020
Error argument in the connection handler is not always set and in some
cases provides meaningless values. For example, every TLS module returns
its specific error codes.

Current solution unifies error codes and allows to distinguish between
different types of disconnection.

Fixes #123.
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

No branches or pull requests

1 participant