Optimize code

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
main
Jianhui Zhao 2018-01-06 14:38:34 +08:00
parent 136967659a
commit ad46c0592b
3 changed files with 4 additions and 4 deletions

View File

@ -19,7 +19,7 @@
//#define EXAMPLE_SSL //#define EXAMPLE_SSL
#define port "8000" #define port 8000
static void hello_action(struct uh_client *cl) static void hello_action(struct uh_client *cl)
{ {

View File

@ -57,12 +57,12 @@ static void uh_accept_cb(struct uloop_fd *fd, unsigned int events)
uh_accept_client(srv, srv->ssl); uh_accept_client(srv, srv->ssl);
} }
struct uh_server *uh_server_new(const char *host, const char *port) struct uh_server *uh_server_new(const char *host, int port)
{ {
struct uh_server *srv = NULL; struct uh_server *srv = NULL;
int sock = -1; int sock = -1;
sock = usock(USOCK_TCP | USOCK_SERVER | USOCK_IPV4ONLY, host, port); sock = usock(USOCK_TCP | USOCK_SERVER | USOCK_IPV4ONLY, host, usock_port(port));
if (sock < 0) { if (sock < 0) {
uh_log_err("usock"); uh_log_err("usock");
return NULL; return NULL;

View File

@ -41,6 +41,6 @@ struct uh_server {
#endif #endif
}; };
struct uh_server *uh_server_new(const char *host, const char *port); struct uh_server *uh_server_new(const char *host, int port);
#endif #endif