MCPcopy Create free account
hub / github.com/ansyun/dpdk-ans / dpdk_https_event

Function dpdk_https_event

examples/https_server/https_server.c:86–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84extern void ans_mod_init();
85
86int dpdk_https_event(struct epoll_event ev,SSL *ssl)
87{
88 char recv_buf[BUFFER_SIZE];
89 int len;
90 int send_len = 0;
91 SSL_CTX *ctx;
92 char buf[MAXBUF + 1];
93
94 if (ev.events&EPOLLIN)
95 {
96 /*Start dealing with the data on the each new connection */
97 bzero(buf, MAXBUF + 1);
98 /* Receive the client's message*/
99 len = SSL_read(ssl, buf, MAXBUF);
100 if (len > 0)
101 {
102 printf("rev success :'%s' datelen is %d\n",
103 buf, len);
104 }
105 else
106 {
107 printf("rev fail: errornum is %d ,errorinfo is '%s'\n",
108 errno, strerror(errno));
109 //goto finish;
110 }
111
112 /* Send messages to the client */
113 len = SSL_write(ssl, https_200, strlen(https_200));
114 if (len <= 0)
115 {
116 printf("message'%s'send fail errornum is %d��errorinfo is '%s'\n",
117 buf, errno, strerror(errno));
118 goto finish;
119 }
120 else
121 {
122 printf("smessage'%s'send success datelen is %d\n",
123 buf, len);
124 }
125 /* The data on the processing each new connection sending and receiving ends*/
126 finish:
127 /*Close the SSL connection */
128 SSL_shutdown(ssl);
129 /* Free SSL */
130 SSL_free(ssl);
131 /* close socket */
132 close(ev.data.fd);
133
134 }
135
136 return 0;
137}
138
139/*----------------------------------------------------------------------------*/
140int RunHttpsThread(void)

Callers 1

RunHttpsThreadFunction · 0.85

Calls 1

closeFunction · 0.85

Tested by

no test coverage detected