Changeset 428

Show
Ignore:
Timestamp:
04/11/08 16:30:30 (7 months ago)
Author:
bellmich
Message:

- fixed response to alerts in tool syncml-obex-client
- fixed disconnect signalling of transport OBEX client

(only one event has to be sent)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libsyncml/transports/obex_client.c

    r423 r428  
    391391                                        break; 
    392392                                case OBEX_CMD_DISCONNECT:; 
    393                                         /* FIXME: Why is this commented out? 
    394                                          * FIMXE: Perhaps because disconnect is signalled always as LINKERR with RSP==0 
    395                                          */ 
    396                                         //smlTransportReceiveEvent(env->tsp, NULL, SML_TRANSPORT_EVENT_DISCONNECT_DONE, NULL, NULL); 
     393                                        if (!env->isDisconnected) 
     394                                        { 
     395                                                env->busy = FALSE; 
     396                                                env->isDisconnected = TRUE; 
     397                                                smlTransportReceiveEvent(env->tsp, NULL, SML_TRANSPORT_EVENT_DISCONNECT_DONE, NULL, NULL); 
     398                                        } 
    397399                                        break; 
    398400                                case OBEX_CMD_GET:; 
     
    452454                        { 
    453455                                /* This is a disconnect. */ 
    454                                 smlTransportReceiveEvent(env->tsp, NULL, SML_TRANSPORT_EVENT_DISCONNECT_DONE, NULL, NULL); 
     456                                if (!env->isDisconnected) 
     457                                { 
     458                                        env->busy = FALSE; 
     459                                        env->isDisconnected = TRUE; 
     460                                        smlTransportReceiveEvent(env->tsp, NULL, SML_TRANSPORT_EVENT_DISCONNECT_DONE, NULL, NULL); 
     461                                } 
    455462                        } else { 
    456463                                /* This is a normal error. */ 
     
    662669        int obex_intf_cnt; 
    663670        obex_interface_t *obex_intf; 
     671        env->isDisconnected = FALSE; 
    664672         
    665673        if (env->type == SML_TRANSPORT_CONNECTION_TYPE_NET) { 
     
    895903                } 
    896904        } 
    897         smlTransportReceiveEvent(env->tsp, NULL, SML_TRANSPORT_EVENT_DISCONNECT_DONE, NULL, NULL); 
     905        /* Note: the disconnect is signaled by OBEX_EV_LINKERR or OBEX_CMD_DISCONNECT */ 
    898906         
    899907        smlTrace(TRACE_EXIT, "%s", __func__); 
  • trunk/libsyncml/transports/obex_client_internals.h

    r414 r428  
    6565        SmlBool error; 
    6666        SmlMimeType mimetype; 
     67        SmlBool isDisconnected; 
    6768} SmlTransportObexClientEnv; 
    6869 
  • trunk/tools/syncml-obex-client.c

    r419 r428  
    216216                        goto error; 
    217217        } else if (slow) { 
     218                /* SLOW-SYNC enforced by tool */ 
    218219                printf("Slowsyncing\n"); 
    219220                if (!smlDsSessionSendAlert(dsession, SML_ALERT_SLOW_SYNC, last, next, _recv_alert_reply, NULL, &error)) 
     
    223224                return FALSE; 
    224225        } else { 
    225                 if (!smlDsSessionSendAlert(dsession, SML_ALERT_TWO_WAY_BY_SERVER, last, next, _recv_alert_reply, NULL, &error)) 
     226                /* We only support SLOW-SYNC and TWO-WAY-SYNC */ 
     227                /* FIXME: Why do we use alert 206? */ 
     228                /* FIXME: Usually 200 and 201 are the correct alert codes. */ 
     229                if (type != SML_ALERT_SLOW_SYNC && 
     230                    type != SML_ALERT_TWO_WAY && 
     231                    type != SML_ALERT_TWO_WAY_BY_SERVER) 
     232                { 
     233                        smlErrorSet(&error, SML_ERROR_GENERIC, "Unsupported alert type %d.", type); 
     234                        goto error; 
     235                } 
     236                if (!smlDsSessionSendAlert(dsession, type, last, next, _recv_alert_reply, NULL, &error)) 
    226237                        goto error; 
    227238        }