mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-20 09:26:37 +00:00
Issue #11: uint16_t instead of short for TCP port number
This commit is contained in:
parent
ffafae86b1
commit
7a8d750a0e
@ -197,7 +197,7 @@ typedef struct rhizome_manifest {
|
|||||||
#define RHIZOME_SERVICE_MESHMS2 "MeshMS2"
|
#define RHIZOME_SERVICE_MESHMS2 "MeshMS2"
|
||||||
|
|
||||||
extern int64_t rhizome_space;
|
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 log2ll(uint64_t x);
|
||||||
int rhizome_configure();
|
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_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 *),
|
int rhizome_http_server_start(int (*http_parse_func)(rhizome_http_request *),
|
||||||
const char *http_parse_func_description,
|
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_enabled();
|
||||||
int is_rhizome_mdp_enabled();
|
int is_rhizome_mdp_enabled();
|
||||||
|
@ -42,7 +42,7 @@ struct profile_total connection_stats;
|
|||||||
specifying the call-back function to use on client connections.
|
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 rhizome_server_socket = -1;
|
||||||
static int request_count=0;
|
static int request_count=0;
|
||||||
static time_ms_t rhizome_server_last_start_attempt = -1;
|
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 *),
|
int rhizome_http_server_start(int (*parse_func)(rhizome_http_request *),
|
||||||
const char *parse_func_desc,
|
const char *parse_func_desc,
|
||||||
int port_low,int port_high)
|
uint16_t port_low, uint16_t port_high)
|
||||||
{
|
{
|
||||||
if (rhizome_server_socket != -1)
|
if (rhizome_server_socket != -1)
|
||||||
return 1;
|
return 1;
|
||||||
@ -103,7 +103,7 @@ int rhizome_http_server_start(int (*parse_func)(rhizome_http_request *),
|
|||||||
if (config.debug.rhizome_tx)
|
if (config.debug.rhizome_tx)
|
||||||
DEBUGF("Starting rhizome HTTP server");
|
DEBUGF("Starting rhizome HTTP server");
|
||||||
|
|
||||||
unsigned short port;
|
uint16_t port;
|
||||||
for (port = port_low; port <= port_high; ++port) {
|
for (port = port_low; port <= port_high; ++port) {
|
||||||
/* Create a new socket, reusable and non-blocking. */
|
/* Create a new socket, reusable and non-blocking. */
|
||||||
if (rhizome_server_socket == -1) {
|
if (rhizome_server_socket == -1) {
|
||||||
@ -158,9 +158,9 @@ error:
|
|||||||
|
|
||||||
success:
|
success:
|
||||||
if (config.rhizome.http.enable)
|
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
|
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 */
|
/* Remember which function to call when handling client connections */
|
||||||
rhizome_http_parse_func=parse_func;
|
rhizome_http_parse_func=parse_func;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user