Commit ed9849f55e6b984ae71fa476eef5ed4a39293232

Authored by Perry Werneck
1 parent af871441

Adding more trace information on "connect" process.

Showing 2 changed files with 22 additions and 28 deletions   Show diff stats
src/core/host.c
... ... @@ -125,6 +125,8 @@ int host_disconnect(H3270 *hSession, int failed)
125 125  
126 126 int lib3270_set_cstate(H3270 *hSession, LIB3270_CSTATE cstate)
127 127 {
  128 + debug("%s(%s,%d)",__FUNCTION__,lib3270_connection_state_get_name(cstate),(int) cstate);
  129 +
128 130 if(hSession->connection.state != cstate)
129 131 {
130 132 trace_dsn(
... ... @@ -216,34 +218,23 @@ void lib3270_set_disconnected(H3270 *hSession)
216 218 /**
217 219 * @brief Signal a state change.
218 220 */
219   -void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode)
  221 +void lib3270_st_changed(H3270 *hSession, LIB3270_STATE tx, int mode)
220 222 {
221   - /*
222   -#if defined(DEBUG)
223   - static const char * state_name[LIB3270_STATE_USER] =
224   - {
225   - "LIB3270_STATE_RESOLVING",
226   - "LIB3270_STATE_CONNECTING",
227   - "LIB3270_STATE_HALF_CONNECT",
228   - "LIB3270_STATE_CONNECT",
229   - "LIB3270_STATE_3270_MODE",
230   - "LIB3270_STATE_LINE_MODE",
231   - "LIB3270_STATE_REMODEL",
232   - "LIB3270_STATE_PRINTER",
233   - "LIB3270_STATE_EXITING",
234   - "LIB3270_STATE_CHARSET"
235   - };
236   -#endif // DEBUG
237   - */
238   -
239 223 struct lib3270_linked_list_node * node;
240 224  
241   - for(node = h->listeners.state[tx].first; node; node = node->next)
  225 + debug("%s(%s,%d)",__FUNCTION__,lib3270_connection_state_get_name(tx),mode);
  226 + trace_dsn(
  227 + hSession,
  228 + "Notifying state %s with mode %d.\n",
  229 + lib3270_connection_state_get_name(tx),
  230 + mode
  231 + );
  232 +
  233 + for(node = hSession->listeners.state[tx].first; node; node = node->next)
242 234 {
243   - ((struct lib3270_state_callback *) node)->func(h,mode,node->userdata);
  235 + ((struct lib3270_state_callback *) node)->func(hSession,mode,node->userdata);
244 236 }
245 237  
246   - trace("%s ends",__FUNCTION__);
247 238 }
248 239  
249 240 static void update_url(H3270 *hSession)
... ...
src/core/screen.c
... ... @@ -640,16 +640,19 @@ LIB3270_EXPORT int lib3270_is_ready(const H3270 *hSession)
640 640 }
641 641  
642 642  
643   -void status_changed(H3270 *session, LIB3270_MESSAGE id)
  643 +void status_changed(H3270 *hSession, LIB3270_MESSAGE id)
644 644 {
645   - CHECK_SESSION_HANDLE(session);
646   -
647   - if(id == session->oia.status || id < 0)
  645 + if(id == hSession->oia.status || id < 0)
648 646 return;
649 647  
650   - session->oia.status = id;
  648 + trace_dsn(
  649 + hSession,
  650 + "Status changed to %d.\n",
  651 + (int) id
  652 + );
651 653  
652   - session->cbk.update_status(session,id);
  654 + hSession->oia.status = id;
  655 + hSession->cbk.update_status(hSession,id);
653 656 }
654 657  
655 658 void status_twait(H3270 *session)
... ...