From 7a8d750a0ef2098e62ba805081f4ce1c16086ca3 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Mon, 7 Oct 2013 23:37:37 +1030 Subject: [PATCH] Issue #11: uint16_t instead of short for TCP port number --- rhizome.h | 4 ++-- rhizome_http.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rhizome.h b/rhizome.h index 59f5d0ff..b5756909 100644 --- a/rhizome.h +++ b/rhizome.h @@ -197,7 +197,7 @@ typedef struct rhizome_manifest { #define RHIZOME_SERVICE_MESHMS2 "MeshMS2" extern int64_t rhizome_space; -extern unsigned short rhizome_http_server_port; +extern uint16_t rhizome_http_server_port; int log2ll(uint64_t x); int rhizome_configure(); @@ -600,7 +600,7 @@ int rhizome_server_http_response(rhizome_http_request *r, int result, int rhizome_server_http_response_header(rhizome_http_request *r, int result, const char *mime_type, uint64_t bytes); int rhizome_http_server_start(int (*http_parse_func)(rhizome_http_request *), const char *http_parse_func_description, - int port_low,int port_high); + uint16_t port_low, uint16_t port_high); int is_rhizome_enabled(); int is_rhizome_mdp_enabled(); diff --git a/rhizome_http.c b/rhizome_http.c index 1514e11b..af089301 100644 --- a/rhizome_http.c +++ b/rhizome_http.c @@ -42,7 +42,7 @@ struct profile_total connection_stats; specifying the call-back function to use on client connections. */ -unsigned short rhizome_http_server_port = 0; +uint16_t rhizome_http_server_port = 0; static int rhizome_server_socket = -1; static int request_count=0; static time_ms_t rhizome_server_last_start_attempt = -1; @@ -90,7 +90,7 @@ int is_rhizome_http_server_running() */ int rhizome_http_server_start(int (*parse_func)(rhizome_http_request *), const char *parse_func_desc, - int port_low,int port_high) + uint16_t port_low, uint16_t port_high) { if (rhizome_server_socket != -1) return 1; @@ -103,7 +103,7 @@ int rhizome_http_server_start(int (*parse_func)(rhizome_http_request *), if (config.debug.rhizome_tx) DEBUGF("Starting rhizome HTTP server"); - unsigned short port; + uint16_t port; for (port = port_low; port <= port_high; ++port) { /* Create a new socket, reusable and non-blocking. */ if (rhizome_server_socket == -1) { @@ -158,9 +158,9 @@ error: success: if (config.rhizome.http.enable) - INFOF("RHIZOME HTTP SERVER, START port=%d fd=%d", port, rhizome_server_socket); + INFOF("RHIZOME HTTP SERVER, START port=%"PRIu16" fd=%d", port, rhizome_server_socket); else - INFOF("HTTP SERVER (LIMITED SERVICE), START port=%d fd=%d", port, rhizome_server_socket); + INFOF("HTTP SERVER (LIMITED SERVICE), START port=%"PRIu16" fd=%d", port, rhizome_server_socket); /* Remember which function to call when handling client connections */ rhizome_http_parse_func=parse_func;