File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -318,14 +318,34 @@ static void aprsis_reconnect(struct aprsis *A)
318
318
a -> ai_protocol );
319
319
errcode = errno ;
320
320
321
- if (A -> server_socket < 0 )
321
+ if (A -> server_socket < 0 ) {
322
+ if (debug ) printf ("aprsis failed to open socket.\n" );
322
323
continue ;
324
+ }
325
+
326
+ if (debug ) {
327
+ char addrstr [INET6_ADDRSTRLEN ];
328
+ void * sin_ptr = NULL ;
329
+ switch (a -> ai_family ) {
330
+ case AF_INET :
331
+ sin_ptr = & ((struct sockaddr_in * ) a -> ai_addr )-> sin_addr ;
332
+ break ;
333
+ case AF_INET6 :
334
+ sin_ptr = & ((struct sockaddr_in6 * ) a -> ai_addr )-> sin6_addr ;
335
+ break ;
336
+ }
337
+ inet_ntop (a -> ai_family , sin_ptr , addrstr , INET6_ADDRSTRLEN );
338
+
339
+ printf ("aprsis connection attempt IPv%d address: %s\n" ,
340
+ (a -> ai_family == PF_INET6 ) ? 6 : 4 , addrstr );
341
+ }
323
342
324
343
errstr = "connection failed" ;
325
344
i = connect (A -> server_socket , a -> ai_addr , a -> ai_addrlen );
326
345
errcode = errno ;
327
346
328
347
if (i < 0 ) {
348
+ if (debug ) printf ("aprsis connection failed.\n" );
329
349
/* If connection fails, try next possible address */
330
350
close (A -> server_socket );
331
351
A -> server_socket = -1 ;
You can’t perform that action at this time.
0 commit comments