void CTcpConn::RunL() { DEBUG_INFO("CTcpConn RunL (%p) iStatus=%d ts=%p tc=%p\n", this, iStatus.Int(), ts, tc); /* This happens after calling cancel functions in socket */ if (iStatus == KErrCancel || iStatus == KErrAbort) { iStatus = KErrNone; return; } else if (iStatus == KErrEof) { ; } else if (iStatus != KErrNone) { DEBUG_WARNING("RunL received iStatus %d\n", iStatus.Int()); } /* Outgoing CONNECT */ if (connecting) { connecting = false; if (iStatus == KErrNone) { int err = 0; DEBUG_INFO("TCP Conn ESTABLISHED\n"); struct le *le = list_head(&tc->helpers); while (le) { struct tcp_helper *th; th = (struct tcp_helper *)le->data; le = le->next; if (th->estabh(&err, tc->active, th->arg) || err) { if (err) tc->conn_close(err); return; } } if (tc->estabh) tc->estabh(tc->arg); StartReceiving(); } else { DEBUG_WARNING("RunL: connecting (%d)\n", iStatus.Int()); tc->conn_close(ECONNREFUSED); } } /* Incoming DATA */ else if (receiving) { if (iStatus == KErrEof) tc->conn_close(0); else tc->recv(); } else { DEBUG_WARNING("CTcpConn RunL: bogus state\n"); } }
static void complete(struct mnat_sess *sess, int err, const char *reason) { mnat_estab_h *estabh = sess->estabh; void *arg = sess->arg; sess->estabh = NULL; if (estabh) { estabh(err, 0, reason, arg); } }
static void complete(struct mnat_sess *sess, int err) { mnat_estab_h *estabh = sess->estabh; if (sess->estabh) { sess->estabh = NULL; estabh(err, 0, "done", sess->arg); } }