Changeset cf02dd6 for libfaim/conn.c


Ignore:
Timestamp:
Dec 10, 2003, 3:20:45 PM (17 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
b1fe407
Parents:
8c46404
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfaim/conn.c

    re374dee rcf02dd6  
    192192
    193193/**
    194  * aim_connrst - Clears out connection list, killing remaining connections.
    195  * @sess: Session to be cleared
    196  *
    197  * Clears out the connection list and kills any connections left.
    198  *
     194 * Clears out connection list, killing remaining connections.
     195 *
     196 * @param sess Session to be cleared
    199197 */
    200198static void aim_connrst(aim_session_t *sess)
     
    218216
    219217/**
    220  * aim_conn_init - Reset a connection to default values.
    221  * @deadconn: Connection to be reset
    222  *
     218 * Reset a connection to default values.
    223219 * Initializes and/or resets a connection structure.
    224220 *
     221 * @param deadconn Connection to be reset
    225222 */
    226223static void aim_conn_init(aim_conn_t *deadconn)
     
    533530                fd = socket(hp->h_addrtype, SOCK_STREAM, 0);
    534531
    535                 if (sess->flags & AIM_SESS_FLAGS_NONBLOCKCONNECT)
     532                if (sess->nonblocking)
    536533                        fcntl(fd, F_SETFL, O_NONBLOCK); /* XXX save flags */
    537534
    538535                if (connect(fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) < 0) {
    539                         if (sess->flags & AIM_SESS_FLAGS_NONBLOCKCONNECT) {
     536                        if (sess->nonblocking) {
    540537                                if ((errno == EINPROGRESS) || (errno == EINTR)) {
    541538                                        if (statusret)
     
    853850
    854851/**
    855  * aim_session_init - Initializes a session structure
    856  * @sess: Session to initialize
    857  * @flags: Flags to use. Any of %AIM_SESS_FLAGS %OR'd together.
    858  * @debuglevel: Level of debugging output (zero is least)
    859  *
    860  * Sets up the initial values for a session.
    861  *
    862  */
    863 faim_export void aim_session_init(aim_session_t *sess, fu32_t flags, int debuglevel)
     852 * Initializes a session structure by setting the initial values
     853 * stuff in the aim_session_t struct.
     854 *
     855 * @param sess Session to initialize.
     856 * @param nonblocking Set to true if you want connections to be non-blocking.
     857 * @param debuglevel Level of debugging output (zero is least).
     858 */
     859faim_export void aim_session_init(aim_session_t *sess, bool nonblocking, int debuglevel)
    864860{
    865861
     
    873869        aim_initsnachash(sess);
    874870        sess->msgcookies = NULL;
    875         sess->icq_info = NULL;
    876         sess->oft_info = NULL;
    877         sess->snacid_next = 0x00000001;
    878 
    879         sess->flags = 0;
     871        sess->nonblocking = nonblocking;
    880872        sess->debug = debuglevel;
    881873        sess->debugcb = defaultdebugcb;
    882 
    883874        sess->modlistv = NULL;
    884 
     875        sess->snacid_next = 0x00000001;
     876
     877        sess->locate.userinfo = NULL;
     878        sess->locate.torequest = NULL;
     879        sess->locate.requested = NULL;
     880        sess->locate.waiting_for_response = FALSE;
    885881        sess->ssi.received_data = 0;
    886882        sess->ssi.numitems = 0;
     
    890886        sess->ssi.timestamp = (time_t)0;
    891887        sess->ssi.waiting_for_ack = 0;
    892 
     888        sess->icq_info = NULL;
    893889        sess->authinfo = NULL;
    894890        sess->emailinfo = NULL;
    895 
    896         /*
    897          * Default to SNAC login unless XORLOGIN is explicitly set.
    898          */
    899         if (!(flags & AIM_SESS_FLAGS_XORLOGIN))
    900                 sess->flags |= AIM_SESS_FLAGS_SNACLOGIN;
    901         sess->flags |= flags;
     891        sess->oft_info = NULL;
    902892
    903893        /*
     
    907897        aim_tx_setenqueue(sess, AIM_TX_QUEUED, NULL);
    908898
    909 
    910899        /*
    911900         * Register all the modules for this session...
    912901         */
    913902        aim__registermodule(sess, misc_modfirst); /* load the catch-all first */
    914         aim__registermodule(sess, general_modfirst);
     903        aim__registermodule(sess, service_modfirst);
    915904        aim__registermodule(sess, locate_modfirst);
    916905        aim__registermodule(sess, buddylist_modfirst);
     
    926915        aim__registermodule(sess, chatnav_modfirst);
    927916        aim__registermodule(sess, chat_modfirst);
    928         /*      aim__registermodule(sess, odir_modfirst); */ /* kretch */
    929         /*      aim__registermodule(sess, bart_modfirst); */ /* kretch */
     917        aim__registermodule(sess, odir_modfirst);
     918        aim__registermodule(sess, bart_modfirst);
    930919        /* missing 0x11 - 0x12 */
    931920        aim__registermodule(sess, ssi_modfirst);
     
    10581047        aim_tx_enqueue(sess, fr);
    10591048
     1049        /* clean out SNACs over 60sec old */
     1050        aim_cleansnacs(sess, 60);
     1051
    10601052        return 0;
    10611053}
Note: See TracChangeset for help on using the changeset viewer.