Commit 5d33a2d4c6c686dc802513bfe7ef9a7a6acc1b1e

Authored by Perry Werneck
1 parent 928fee28
Exists in master and in 2 other branches develop, macos

Debugging auto-reconnect.

Showing 2 changed files with 11 additions and 27 deletions   Show diff stats
src/core/connect.c
@@ -53,32 +53,6 @@ @@ -53,32 +53,6 @@
53 53
54 } 54 }
55 55
56 -/*  
57 - void connection_failed(H3270 *hSession, const char *message)  
58 - {  
59 - lib3270_disconnect(hSession);  
60 -  
61 - lib3270_autoptr(char) summary = lib3270_strdup_printf(  
62 - _( "Can't connect to %s:%s"),  
63 - hSession->host.current,  
64 - hSession->host.srvc  
65 - );  
66 -  
67 - LIB3270_POPUP popup = {  
68 - .name = "CantConnect",  
69 -// .title = _( "Connection failed" ),  
70 - .type = LIB3270_NOTIFY_INFO,  
71 - .summary = summary,  
72 - .body = message,  
73 - .label = _("Try again")  
74 - };  
75 -  
76 - if(hSession->cbk.popup(hSession,&popup,!hSession->auto_reconnect_inprogress) == 0)  
77 - lib3270_activate_auto_reconnect(hSession,1000);  
78 -  
79 - }  
80 -*/  
81 -  
82 int lib3270_allow_reconnect(const H3270 *hSession) 56 int lib3270_allow_reconnect(const H3270 *hSession)
83 { 57 {
84 // 58 //
@@ -103,7 +77,8 @@ @@ -103,7 +77,8 @@
103 // Do I have a defined host? 77 // Do I have a defined host?
104 if(!(hSession->host.current && hSession->host.srvc && *hSession->host.current && *hSession->host.srvc)) 78 if(!(hSession->host.current && hSession->host.srvc && *hSession->host.current && *hSession->host.srvc))
105 { 79 {
106 - errno = EINVAL; 80 + debug("%s('%s')",__FUNCTION__,hSession->host.url);
  81 + errno = ENODATA;
107 return 0; 82 return 0;
108 } 83 }
109 84
src/include/lib3270.h
@@ -546,6 +546,10 @@ @@ -546,6 +546,10 @@
546 * 546 *
547 * @return zero if reconnect is unavailable (sets errno), non zero if available. 547 * @return zero if reconnect is unavailable (sets errno), non zero if available.
548 * 548 *
  549 + * @retval ENODATA Invalid or empty hostname.
  550 + * @retval EBUSY Auto reconnect in progress.
  551 + * @retval EISCONN Session is connected.
  552 + *
549 */ 553 */
550 LIB3270_EXPORT int lib3270_allow_reconnect(const H3270 *hSession); 554 LIB3270_EXPORT int lib3270_allow_reconnect(const H3270 *hSession);
551 555
@@ -557,6 +561,11 @@ @@ -557,6 +561,11 @@
557 * 561 *
558 * @return 0 for success, non zero if fails (sets errno). 562 * @return 0 for success, non zero if fails (sets errno).
559 * 563 *
  564 + * @retval ENODATA Invalid or empty hostname.
  565 + * @retval EBUSY Auto reconnect in progress.
  566 + * @retval EISCONN Session is connected.
  567 + * @retval -1 Unexpected error.
  568 + *
560 */ 569 */
561 LIB3270_EXPORT int lib3270_reconnect(H3270 *hSession,int seconds); 570 LIB3270_EXPORT int lib3270_reconnect(H3270 *hSession,int seconds);
562 571