2014-02-19 1 views
0

libstrophe를 사용하여 C에서 간단한 ejabberd 클라이언트를 개발 중입니다. 그것은 연결되어 있어야하고 예상대로 메시지를 처리하기 시작합니다.Strophe 복구 할 수없는 TLS 오류

그러나 잠시 후 (ejabberd 서버에서 두 번 또는 세 번 실행 한 후) 연결이 닫히고 상태는 DISCONNECTED으로 설정됩니다. 아래는 디버그 라인의 꼬리입니다.

xmpp DEBUG Unrecoverable TLS error, 5. 
xmpp DEBUG Closing socket. 
DEBUG: disconnected event DEBUG Stopping event loop. 
event DEBUG Event 
oop completed. 

다음과 같이 초기화하고 연결합니다.

xmpp_initialize(); 

/* read connection params */ 
if(set_xmpp_conn_params(&conn_params) < 0) { 
    fprintf(stderr, "Could not retrieve connection params from %s\n", 
        SERVER_CONF_FILE); 
    return -1; 
} 

/* initialize the XMPP logger */ 
xmpp_log = xmpp_get_default_logger(XMPP_LOG_LEVEL); 
xmpp_ctx = xmpp_ctx_new(NULL, xmpp_log); 

/* create a connection */ 
xmpp_conn = xmpp_conn_new(xmpp_ctx); 

/* login */ 
xmpp_conn_set_jid(xmpp_conn, conn_params.jid); 
xmpp_conn_set_pass(xmpp_conn, conn_params.password); 

/* create a client */ 
xmpp_connect_client( xmpp_conn, conn_params.host, 0, 
         agent_conn_handler, xmpp_ctx); 

/* enter the event loop */ 
xmpp_run(xmpp_ctx); 

/* the code below is executed 
    whenever connection handler @agent_conn_handler exits */ 

/* release the connection and context */ 
xmpp_conn_release(xmpp_conn); 
xmpp_ctx_free(xmpp_ctx); 

왜 TLS 오류 메시지가 표시됩니까?

감사합니다.

+0

TLS에 openssl, gnutls 또는 schannel을 사용하고 있습니까? –

+0

예,'openssl'을 사용하고 있습니다. –

답변

0

오류 5는 SSL_ERROR_SYSCALL입니다. 에는 OpenSSL docs 말 :

Some I/O error occurred. The OpenSSL error queue may contain more information on the error. If the error queue is empty (i.e. ERR_get_error() returns 0), ret can be used to find out more about the error: If ret == 0, an EOF was observed that violates the protocol. If ret == -1, the underlying BIO reported an I/O error (for socket I/O on Unix systems, consult errno for details).

실제로,이 서버가 어떤 이유로 연결을 떨어 의미합니다. 더 많은 정보를 얻으려면 WireShark으로 패킷 추적을하는 것이 좋습니다. 예를 들어, 클라이언트가 TLS 버전 1.1을 제공 할 때 TLS 용 RSA 라이브러리를 사용하는 서버에서 이러한 현상이 발생하는 것을 보았습니다.

+0

Wireshark를 살펴볼 때 연결을 끊기 전에 클라이언트는 먼저 서버로부터 [FIN, ACK] 패킷을 보내고 RST를받습니다. 네 사건을 어떻게 해결 했니? –

+0

클라이언트가 FIN/ACK를 보내기 전에 서버가 FIN을 보냅니 까? 또한 스트림을 SSL로 디코딩하고 마지막 SSL 메시지가 무엇인지 확인하십시오. 우리가 본 경우에 서버에서 RSA 라이브러리를 교체 할 때까지 클라이언트가 TLS 1.0을 사용하도록 강제해야했습니다. –

+0

안녕하세요, 저는 libstrophe를 XMPP 클라이언트로 사용하여 응용 프로그램을 만들었습니다. "복구 할 수없는 TLS 오류, 6"과 관련된 경험이 있습니까? ? –