diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-04-05 10:49:38 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-04-05 10:49:38 +0200 |
commit | d4b30a7a84742ae03774fe25af2cbad144ba2d5d (patch) | |
tree | d65a66f9f2f9378a1f4ca014e18952ae514f4cb1 /extra/yassl/examples/echoserver/echoserver.cpp | |
parent | d993ce1bbf8413a0aaf5a524a11334359234c5f4 (diff) | |
parent | cea2c5d28ead6ae4191aea164df9b80b41a743ad (diff) | |
download | mariadb-git-mariadb-5.1.62.tar.gz |
mysql-5.1.62 mergemariadb-5.1.62
Diffstat (limited to 'extra/yassl/examples/echoserver/echoserver.cpp')
-rw-r--r-- | extra/yassl/examples/echoserver/echoserver.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/extra/yassl/examples/echoserver/echoserver.cpp b/extra/yassl/examples/echoserver/echoserver.cpp index 92613744ba0..03a4a461634 100644 --- a/extra/yassl/examples/echoserver/echoserver.cpp +++ b/extra/yassl/examples/echoserver/echoserver.cpp @@ -75,11 +75,11 @@ THREAD_RETURN YASSL_API echoserver_test(void* args) #endif while (!shutdown) { - sockaddr_in client; + SOCKADDR_IN_T client; socklen_t client_len = sizeof(client); SOCKET_T clientfd = accept(sockfd, (sockaddr*)&client, (ACCEPT_THIRD_T)&client_len); - if (clientfd == -1) { + if (clientfd == (SOCKET_T) -1) { SSL_CTX_free(ctx); tcp_close(sockfd); err_sys("tcp accept failed"); @@ -93,11 +93,11 @@ THREAD_RETURN YASSL_API echoserver_test(void* args) tcp_close(clientfd); continue; } - + char command[1024]; int echoSz(0); while ( (echoSz = SSL_read(ssl, command, sizeof(command))) > 0) { - + if ( strncmp(command, "quit", 4) == 0) { printf("client sent quit command: shutting down!\n"); shutdown = true; @@ -109,7 +109,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args) char header[] = "<html><body BGCOLOR=\"#ffffff\">\n<pre>\n"; char body[] = "greetings from yaSSL\n"; char footer[] = "</body></html>\r\n\r\n"; - + strncpy(command, type, sizeof(type)); echoSz = sizeof(type) - 1; @@ -122,7 +122,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args) if (SSL_write(ssl, command, echoSz) != echoSz) EchoError(ctx, ssl, sockfd, clientfd, "SSL_write failed"); - + break; } command[echoSz] = 0; |