Commit e5e419e2c6ce7b32fd461df047c44446a1a0b5be

Authored by Perry Werneck
1 parent 33d0e075

Investigando problema na conexão via PHP.

src/lib3270/connect.c
@@ -537,6 +537,7 @@ static void net_connected(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *d @@ -537,6 +537,7 @@ static void net_connected(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *d
537 } 537 }
538 538
539 lib3270_disconnect(hSession); 539 lib3270_disconnect(hSession);
  540 + lib3270_write_log(hSession,"connect", "%s",__FUNCTION__,strerror(ETIMEDOUT));
540 return ETIMEDOUT; 541 return ETIMEDOUT;
541 } 542 }
542 543
src/libpw3270cpp/remote.cc
@@ -915,14 +915,13 @@ @@ -915,14 +915,13 @@
915 915
916 while(time(0) < end) 916 while(time(0) < end)
917 { 917 {
918 - static const dbus_int32_t delay = 2;  
919 -  
920 - int rc = query_intval("waitForReady", DBUS_TYPE_INT32, &delay, DBUS_TYPE_INVALID); 918 + if(!is_connected())
  919 + return ENOTCONN;
921 920
922 - trace("waitForReady exits with rc=%d",rc); 921 + if(is_ready())
  922 + return 0;
923 923
924 - if(rc != ETIMEDOUT)  
925 - return rc; 924 + sleep(1);
926 } 925 }
927 926
928 return ETIMEDOUT; 927 return ETIMEDOUT;
@@ -991,7 +990,7 @@ @@ -991,7 +990,7 @@
991 return 0; 990 return 0;
992 #elif defined(HAVE_DBUS) 991 #elif defined(HAVE_DBUS)
993 if(wait) 992 if(wait)
994 - usleep(250); 993 + sleep(1);
995 return 0; 994 return 0;
996 #else 995 #else
997 return -1; 996 return -1;
src/libpw3270cpp/session.cc
@@ -632,7 +632,7 @@ @@ -632,7 +632,7 @@
632 } 632 }
633 633
634 rc = connect(); 634 rc = connect();
635 - trace("%s: connect=%d",__FUNCTION__,rc); 635 + trace("%s: connect=%d wait=%u",__FUNCTION__,rc,(unsigned int) wait);
636 636
637 if(!rc && wait) 637 if(!rc && wait)
638 { 638 {
src/libpw3270cpp/testprogram.cc
@@ -48,6 +48,7 @@ @@ -48,6 +48,7 @@
48 cout << "pw3270 version: " << session->get_version() << endl; 48 cout << "pw3270 version: " << session->get_version() << endl;
49 cout << "pw3270 revision: " << session->get_revision() << endl << endl; 49 cout << "pw3270 revision: " << session->get_revision() << endl << endl;
50 50
  51 + /*
51 if(session->is_connected()) 52 if(session->is_connected())
52 cout << "\tConnected to host" << endl; 53 cout << "\tConnected to host" << endl;
53 else 54 else
@@ -60,6 +61,7 @@ @@ -60,6 +61,7 @@
60 61
61 s = session->get_host_charset(); 62 s = session->get_host_charset();
62 cout << "\tHost charset: " << s.c_str() << endl; 63 cout << "\tHost charset: " << s.c_str() << endl;
  64 + */
63 65
64 cout << "Connect: " << session->connect("fandezhi.efglobe.com:23",60) << endl << endl; 66 cout << "Connect: " << session->connect("fandezhi.efglobe.com:23",60) << endl << endl;
65 67
@@ -69,6 +71,7 @@ @@ -69,6 +71,7 @@
69 cout << "\tIsReady: " << session->is_ready() << endl; 71 cout << "\tIsReady: " << session->is_ready() << endl;
70 cout << "\tString(3,2,14) " << session->get_string_at(3,2,14) << endl; 72 cout << "\tString(3,2,14) " << session->get_string_at(3,2,14) << endl;
71 73
  74 + session->disconnect();
72 delete session; 75 delete session;
73 } 76 }
74 77
src/plugins/dbus3270/gobject.c
@@ -342,7 +342,7 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus @@ -342,7 +342,7 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus
342 342
343 void pw3270_dbus_is_connected(PW3270Dbus *object, DBusGMethodInvocation *context) 343 void pw3270_dbus_is_connected(PW3270Dbus *object, DBusGMethodInvocation *context)
344 { 344 {
345 - trace("%s object=%p context=%p",__FUNCTION__,object,context); 345 + trace("%s object=%p context=%p connected=%s",__FUNCTION__,object,context, lib3270_is_connected(pw3270_dbus_get_session_handle(object)) ? "Yes" : "No");
346 dbus_g_method_return(context,lib3270_is_connected(pw3270_dbus_get_session_handle(object))); 346 dbus_g_method_return(context,lib3270_is_connected(pw3270_dbus_get_session_handle(object)));
347 } 347 }
348 348