Changeset 415
- Timestamp:
- 03/14/08 15:25:16 (8 months ago)
- Files:
-
- trunk/libsyncml/objects/sml_devinf_obj.c (modified) (2 diffs)
- trunk/libsyncml/parser/sml_xml_parse.c (modified) (2 diffs)
- trunk/libsyncml/sml_session.c (modified) (5 diffs)
- trunk/libsyncml/sml_session_internals.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libsyncml/objects/sml_devinf_obj.c
r361 r415 271 271 void smlDevInfAgentSetDevInf(SmlDevInfAgent *agent, SmlDevInf *devinf) 272 272 { 273 smlTrace(TRACE_ENTRY, "%s(%p, %p)", __func__, agent, devinf); 273 274 smlAssert(agent); 274 275 smlAssert(devinf); 275 276 agent->recvDevInf = devinf; 277 smlTrace(TRACE_EXIT, "%s", __func__); 276 278 } 277 279 … … 279 281 SmlDevInf *smlDevInfAgentGetDevInf(SmlDevInfAgent *agent) 280 282 { 283 smlTrace(TRACE_INTERNAL, "%s(%p)", __func__, agent); 281 284 smlAssert(agent); 282 285 return agent->recvDevInf; trunk/libsyncml/parser/sml_xml_parse.c
r412 r415 1876 1876 goto error_free_status; 1877 1877 } else if (!strcmp((char *)xmlTextReaderConstName(parser->reader), SML_ELEMENT_ITEM)) { 1878 item = _smlItemParse(parser, NULL, SML_COMMAND_TYPE_ALERT, error); 1878 /* Do not send SML_COMMAND_TYPE_ALERT 1879 * because this can give trouble. 1880 * Example: Error message for a failed ADD 1881 */ 1882 item = _smlItemParse(parser, NULL, (*status)->type, error); 1879 1883 if (!item) 1880 1884 goto error_free_status; … … 1894 1898 goto error_free_status; 1895 1899 } 1896 1897 if (item && (*status)->type != SML_COMMAND_TYPE_ALERT) { 1898 smlErrorSet(error, SML_ERROR_GENERIC, "Got wrong item"); 1899 smlItemUnref(item); 1900 goto error_free_status; 1901 } 1902 1903 if (item && (*status)->type == SML_COMMAND_TYPE_ALERT) { 1904 (*status)->anchor = item->anchor; 1905 item->anchor = NULL; 1900 1901 if (item) 1902 { 1903 if ((*status)->type == SML_COMMAND_TYPE_ALERT) { 1904 (*status)->anchor = item->anchor; 1905 item->anchor = NULL; 1906 } else if ((*status)->type == SML_COMMAND_TYPE_ADD || 1907 (*status)->type == SML_COMMAND_TYPE_REPLACE || 1908 (*status)->type == SML_COMMAND_TYPE_DELETE) { 1909 /* Usually Sync is commited at once or together with an anchor. 1910 * If a single ADD, REPLACE or DELETE gets an item 1911 * then there is something going wrong. 1912 */ 1913 g_warning("%s", xmlBufferContent(item->buffer)); 1914 } else { 1915 smlErrorSet(error, SML_ERROR_GENERIC, "Got wrong item"); 1916 smlItemUnref(item); 1917 goto error_free_status; 1918 } 1906 1919 smlItemUnref(item); 1907 1920 } trunk/libsyncml/sml_session.c
r412 r415 139 139 smlTrace(TRACE_INTERNAL, "Ending session now"); 140 140 session->end = TRUE; 141 smlSessionRestoreTargetURI(session); 141 142 smlSessionDispatchEvent(session, SML_SESSION_EVENT_END, NULL, NULL, NULL, NULL); 142 143 } … … 608 609 * then the URI in the transport layer must be adjusted. */ 609 610 if (header->responseURI) { 610 SmlLocation *old = session->target; 611 if (!session->orgTarget) { 612 /* If the original target is already set 613 * then it MUST NOT be set again 614 * because this would destroy the real original 615 * target and an earlier RespURI would be used 616 * as original target. 617 */ 618 session->orgTarget = session->target; 619 } 620 621 /* build the new target and publish it*/ 611 622 session->target = smlLocationNew( 612 623 header->responseURI, 613 smlLocationGetName(session-> target),624 smlLocationGetName(session->orgTarget), 614 625 error); 615 smlLocationUnref(old);616 626 if (!session->target) 617 627 goto error; 618 628 smlSessionDispatchEvent(session, SML_SESSION_EVENT_RESPONSE_URI, NULL, NULL, NULL, NULL); 629 smlTrace(TRACE_INTERNAL, "%s: RespURI: %s, Target: %s", __func__, 630 smlLocationGetURI(session->target), 631 smlLocationGetURI(session->orgTarget)); 619 632 } 620 633 smlTrace(TRACE_EXIT, "%s", __func__); … … 1299 1312 */ 1300 1313 if (!final || session->sessionType != SML_SESSION_TYPE_SERVER) 1314 { 1315 smlSessionRestoreTargetURI(session); 1301 1316 smlSessionDispatchEvent(session, SML_SESSION_EVENT_END, NULL, NULL, NULL, NULL); 1317 } 1302 1318 } 1303 1319 … … 1657 1673 */ 1658 1674 smlTrace(TRACE_INTERNAL, "%s: no status/command ... only sending event", __func__); 1675 smlSessionRestoreTargetURI(session); 1659 1676 smlSessionDispatchEvent(session, SML_SESSION_EVENT_END, NULL, NULL, NULL, NULL); 1660 1677 } … … 1666 1683 smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); 1667 1684 return FALSE; 1685 } 1686 1687 void smlSessionRestoreTargetURI(SmlSession *session) 1688 { 1689 smlTrace(TRACE_ENTRY, "%s(%p)", __func__, session); 1690 smlAssert(session); 1691 1692 if (session->orgTarget) { 1693 /* Restore original target if RespURI was used. 1694 * This is important if somebody re-use the transport layer. 1695 * Example: Sometimes an OMA DS client needs two OMA DS sessions 1696 * to synchronize (e.g. OpenSync's SyncML plugin). 1697 */ 1698 smlLocationUnref(session->target); 1699 session->target = session->orgTarget; 1700 session->orgTarget = NULL; 1701 smlSessionDispatchEvent(session, SML_SESSION_EVENT_RESPONSE_URI, NULL, NULL, NULL, NULL); 1702 } 1703 1704 smlTrace(TRACE_EXIT, "%s", __func__); 1668 1705 } 1669 1706 trunk/libsyncml/sml_session_internals.h
r366 r415 41 41 42 42 SmlLocation *target; 43 SmlLocation *orgTarget; 43 44 SmlLocation *source; 44 45 SmlCred *cred; … … 97 98 void smlSessionUnlock(SmlSession *session); 98 99 100 void smlSessionRestoreTargetURI(SmlSession *session); 101 99 102 #endif //_SML_SESSION_INTERNALS_H_
