View | Details | Raw Unified | Return to ticket 14595
Collapse All | Expand All

(-)a/NEWS (+2 lines)
Lines 52-57 documents those changes that are of interest to users and administrators. Link Here
52
    provided by client.
52
    provided by client.
53
 -- openapi/dbv0.0.38 - accept job state filter as verbose names instead of
53
 -- openapi/dbv0.0.38 - accept job state filter as verbose names instead of
54
    only numeric state ids.
54
    only numeric state ids.
55
 -- conmgr - avoid lazy linking of host parser which causes configure to fail
56
    with argument '--without-shared-libslurm'.
55
57
56
* Changes in Slurm 22.05.2
58
* Changes in Slurm 22.05.2
57
==========================
59
==========================
(-)a/src/common/conmgr.c (-3 / +7 lines)
Lines 212-224 try_again: Link Here
212
	}
212
	}
213
}
213
}
214
214
215
extern con_mgr_t *init_con_mgr(int thread_count)
215
extern con_mgr_t *init_con_mgr(int thread_count,
216
	parse_host_port_t parse_host_port,
217
	free_parse_host_port_t free_parse_host_port)
216
{
218
{
217
	con_mgr_t *mgr = xmalloc(sizeof(*mgr));
219
	con_mgr_t *mgr = xmalloc(sizeof(*mgr));
218
220
219
	mgr->magic = MAGIC_CON_MGR;
221
	mgr->magic = MAGIC_CON_MGR;
220
	mgr->connections = list_create(NULL);
222
	mgr->connections = list_create(NULL);
221
	mgr->listen = list_create(NULL);
223
	mgr->listen = list_create(NULL);
224
	mgr->parse_host_port = parse_host_port;
225
	mgr->free_parse_host_port = free_parse_host_port;
222
226
223
	slurm_mutex_init(&mgr->mutex);
227
	slurm_mutex_init(&mgr->mutex);
224
	slurm_cond_init(&mgr->cond, NULL);
228
	slurm_cond_init(&mgr->cond, NULL);
Lines 1845-1851 static int _create_socket(void *x, void *arg) Link Here
1845
			unixsock);
1849
			unixsock);
1846
	} else {
1850
	} else {
1847
		/* split up host and port */
1851
		/* split up host and port */
1848
		if (!(parsed_hp = parse_host_port(hostport)))
1852
		if (!(parsed_hp = init->mgr->parse_host_port(hostport)))
1849
			fatal("%s: Unable to parse %s", __func__, hostport);
1853
			fatal("%s: Unable to parse %s", __func__, hostport);
1850
1854
1851
		/* resolve out the host and port if provided */
1855
		/* resolve out the host and port if provided */
Lines 1904-1910 static int _create_socket(void *x, void *arg) Link Here
1904
	}
1908
	}
1905
1909
1906
	freeaddrinfo(addrlist);
1910
	freeaddrinfo(addrlist);
1907
	free_parse_host_port(parsed_hp);
1911
	init->mgr->free_parse_host_port(parsed_hp);
1908
1912
1909
	return rc;
1913
	return rc;
1910
}
1914
}
(-)a/src/common/conmgr.h (-1 / +29 lines)
Lines 82-87 typedef int (*con_mgr_on_connection_data_t)(con_mgr_fd_t *con, void *arg); Link Here
82
 */
82
 */
83
typedef void (*con_mgr_on_connection_finish)(void *arg);
83
typedef void (*con_mgr_on_connection_finish)(void *arg);
84
84
85
typedef struct {
86
	const char *host;
87
	const char *port; /* port as string for later parsing */
88
} parsed_host_port_t;
89
90
/*
91
 * Parse a combined host:port string into host and port
92
 * IN str host:port string for parsing
93
 * OUT parsed will be populated with strings (must xfree())
94
 * RET SLURM_SUCCESS or error
95
 */
96
typedef parsed_host_port_t *(*parse_host_port_t)(const char *str);
97
98
/*
99
 * Free parsed_host_port_t returned from parse_host_port_t()
100
 */
101
typedef void (*free_parse_host_port_t)(parsed_host_port_t *parsed);
102
103
85
/*
104
/*
86
 * Struct of call backs to call on events
105
 * Struct of call backs to call on events
87
 * of a given connection.
106
 * of a given connection.
Lines 196-201 struct con_mgr_s { Link Here
196
	/* First observed error */
215
	/* First observed error */
197
	int error;
216
	int error;
198
217
218
	/* functions to handle host/port parsing */
219
	parse_host_port_t parse_host_port;
220
	free_parse_host_port_t free_parse_host_port;
221
199
	pthread_mutex_t mutex;
222
	pthread_mutex_t mutex;
200
	/* called after events or changes to wake up _watch */
223
	/* called after events or changes to wake up _watch */
201
	pthread_cond_t cond;
224
	pthread_cond_t cond;
Lines 205-213 struct con_mgr_s { Link Here
205
 * create and init a connection manager
228
 * create and init a connection manager
206
 * only call once!
229
 * only call once!
207
 * IN thread_count - number of threads to create
230
 * IN thread_count - number of threads to create
231
 * IN parse_host_port - function to parse host/port string
232
 * IN free_parse_host_port - function to release parsed host/ports
233
 * IN thread_count - number of threads to create
208
 * RET SLURM_SUCCESS or error
234
 * RET SLURM_SUCCESS or error
209
 */
235
 */
210
extern con_mgr_t *init_con_mgr(int thread_count);
236
extern con_mgr_t *init_con_mgr(int thread_count,
237
	parse_host_port_t parse_host_port,
238
	free_parse_host_port_t free_parse_host_port);
211
extern void free_con_mgr(con_mgr_t *mgr);
239
extern void free_con_mgr(con_mgr_t *mgr);
212
240
213
/*
241
/*
(-)a/src/common/http.c (-12 lines)
Lines 302-316 extern http_request_method_t get_http_method(const char *str) Link Here
302
		return HTTP_REQUEST_TRACE;
302
		return HTTP_REQUEST_TRACE;
303
	return HTTP_REQUEST_INVALID;
303
	return HTTP_REQUEST_INVALID;
304
}
304
}
305
306
/* parse according to rfc8820 & rfc3986 */
307
extern parsed_host_port_t *parse_host_port(const char *str)
308
{
309
	fatal_abort("code stub");
310
	return NULL;
311
}
312
313
extern void free_parse_host_port(parsed_host_port_t *parsed)
314
{
315
	fatal_abort("code stub");
316
}
(-)a/src/common/http.h (-18 lines)
Lines 137-158 extern const char *get_http_method_string(const http_request_method_t method); Link Here
137
extern data_t *parse_url_path(const char *path, bool convert_types,
137
extern data_t *parse_url_path(const char *path, bool convert_types,
138
			      bool allow_templates);
138
			      bool allow_templates);
139
139
140
typedef struct {
141
	const char *host;
142
	const char *port; /* port as string for later parsing */
143
} parsed_host_port_t;
144
145
/*
146
 * Parse a combined host:port string into host and port
147
 * IN str host:port string for parsing
148
 * OUT parsed will be populated with strings (must xfree())
149
 * RET SLURM_SUCCESS or error
150
 */
151
extern parsed_host_port_t *parse_host_port(const char *str);
152
153
/*
154
 * Free parsed_host_port_t returned from parse_host_port()
155
 */
156
extern void free_parse_host_port(parsed_host_port_t *parsed);
157
158
#endif /* SLURM_HTTP_H */
140
#endif /* SLURM_HTTP_H */
(-)a/src/slurmrestd/slurmrestd.c (-2 / +5 lines)
Lines 106-111 bool unshare_sysv = true; Link Here
106
bool unshare_files = true;
106
bool unshare_files = true;
107
bool check_user = true;
107
bool check_user = true;
108
108
109
extern parsed_host_port_t *parse_host_port(const char *str);
110
extern void free_parse_host_port(parsed_host_port_t *parsed);
111
109
/* SIGPIPE handler - mostly a no-op */
112
/* SIGPIPE handler - mostly a no-op */
110
static void _sigpipe_handler(int signum)
113
static void _sigpipe_handler(int signum)
111
{
114
{
Lines 398-404 int main(int argc, char **argv) Link Here
398
	if (data_init(NULL, NULL))
401
	if (data_init(NULL, NULL))
399
		fatal("Unable to initialize data static structures");
402
		fatal("Unable to initialize data static structures");
400
403
401
	if (!(conmgr = init_con_mgr(run_mode.listen ? thread_count : 1)))
404
	if (!(conmgr = init_con_mgr((run_mode.listen ? thread_count : 1),
405
				    parse_host_port, free_parse_host_port)))
402
		fatal("Unable to initialize connection manager");
406
		fatal("Unable to initialize connection manager");
403
407
404
	if (init_operations())
408
	if (init_operations())
405
- 

Return to ticket 14595