@@ -127,7 +127,7 @@ static kvtree* service_request_AXL_Config_Set(int sd)
127
127
}
128
128
#endif
129
129
130
- static ssize_t service_request_from_client (int sd )
130
+ static ssize_t axl_socket_request_from_client (int sd )
131
131
{
132
132
ssize_t bytecount ;
133
133
axl_socket_Request req ;
@@ -171,6 +171,7 @@ static ssize_t service_request_from_client(int sd)
171
171
172
172
static void sigterm_handler (int sig , siginfo_t * info , void * ucontext )
173
173
{
174
+ AXL_DBG (2 , "SIGTERM Received" );
174
175
time_to_leave ++ ;
175
176
}
176
177
@@ -250,12 +251,15 @@ int axl_socket_server_run(int port)
250
251
251
252
activity = select (max_sd + 1 , & readfds , NULL , NULL , NULL );
252
253
254
+ if (time_to_leave )
255
+ break ;
256
+
253
257
if (activity < 0 && errno != EINTR ) {
254
258
AXL_ABORT (-1 , "select() error: (%s)" , strerror (errno ));
255
259
}
256
260
257
261
if (FD_ISSET (server_socket , & readfds )) {
258
- AXL_DBG (0 , "Accepting new incomming connection" );
262
+ AXL_DBG (1 , "Accepting new incomming connection" );
259
263
if ((new_socket = accept (server_socket , (struct sockaddr * )& address ,
260
264
(socklen_t * )& addrlen )) < 0 ) {
261
265
AXL_ABORT (-1 , "accept() error: (%s)" , strerror (errno ));
@@ -267,15 +271,15 @@ int axl_socket_server_run(int port)
267
271
break ;
268
272
}
269
273
}
270
- AXL_DBG (0 , "Connection established" );
274
+ AXL_DBG (1 , "Connection established" );
271
275
}
272
276
273
277
for ( int i = 0 ; i < AXL_SOCKET_MAX_CLIENTS ; i ++ ) {
274
278
if (FD_ISSET (axl_socket_conn_ctx_array [i ].sd , & readfds )) {
275
279
axl_xfer_list = & axl_socket_conn_ctx_array [i ].xfr ;
276
280
277
- if (service_request_from_client (axl_socket_conn_ctx_array [i ].sd ) == 0 ) {
278
- AXL_DBG (0 , "Closing server side socket(%d) to client" , axl_socket_conn_ctx_array [i ].sd );
281
+ if (axl_socket_request_from_client (axl_socket_conn_ctx_array [i ].sd ) == 0 ) {
282
+ AXL_DBG (1 , "Closing server side socket(%d) to client" , axl_socket_conn_ctx_array [i ].sd );
279
283
close (axl_socket_conn_ctx_array [i ].sd );
280
284
axl_socket_conn_ctx_array [i ].sd = 0 ;
281
285
axl_free (& axl_xfer_list -> axl_kvtrees );
0 commit comments