Changeset 512
- Timestamp:
- 07/25/08 15:43:24 (4 months ago)
- Files:
-
- trunk/libsyncml/sml_manager.c (modified) (1 diff)
- trunk/libsyncml/sml_transport.c (modified) (4 diffs)
- trunk/libsyncml/transports/http_client.c (modified) (2 diffs)
- trunk/tests/check_http.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libsyncml/sml_manager.c
r500 r512 342 342 // if the context is already set 343 343 // then the transport is already running in asynchronous mode 344 g_warning("Manager context is used by transport context."); 344 345 tsp->context = manager->context; 345 346 g_main_context_ref(tsp->context); trunk/libsyncml/sml_transport.c
r491 r512 188 188 goto error; 189 189 } 190 if (tsp->context != NULL) { 191 smlErrorSet(error, SML_ERROR_GENERIC, "Transport is already in asynchronous mode!"); 192 goto error; 193 } 194 195 g_type_init(); 190 196 191 197 tsp->context = g_main_context_new(); … … 552 558 if (tsp->context) 553 559 g_main_context_unref(tsp->context); 560 tsp->context = NULL; 554 561 555 562 smlSafeFree((gpointer *)&tsp); … … 661 668 smlAssertMsg(*error == NULL, SML_ASSERT_MSG_ERROR_MUST_BE_EMPTY); 662 669 smlAssert(tsp); 663 smlAssert(tsp->functions.initialize);664 670 smlAssert(tsp->state == SML_TRANSPORT_UNINITIALIZED); 665 671 … … 668 674 smlQueueAttach(tsp->command_queue, tsp->context); 669 675 670 if ( !tsp->functions.initialize(tsp, error))676 if (tsp->functions.initialize && !tsp->functions.initialize(tsp, error)) 671 677 goto error_detach; 672 678 trunk/libsyncml/transports/http_client.c
r509 r512 296 296 } 297 297 298 /**299 * @defgroup GroupID Group Description300 * @ingroup ParentGroupID301 * @brief What does this group do?302 *303 */304 /*@{*/305 306 static SmlBool smlTransportHttpClientInit(SmlTransport *tsp, SmlError **error)307 {308 smlTrace(TRACE_ENTRY, "%s(%p, %p)", __func__, tsp, error);309 smlAssertMsg(error, SML_ASSERT_MSG_ERROR_MUST_NOT_BE_NULL);310 smlAssertMsg(*error == NULL, SML_ASSERT_MSG_ERROR_MUST_BE_EMPTY);311 smlAssert(tsp);312 smlAssert(tsp->transport_data);313 SmlTransportHttpClientEnv *env = tsp->transport_data;314 315 g_type_init();316 317 smlTransportRunAsync(tsp, error);318 319 smlTrace(TRACE_EXIT, "%s: %p", __func__, env);320 return TRUE;321 }322 323 298 static SmlBool smlTransportHttpClientSetResponseURI( 324 299 SmlTransport *tsp, … … 497 472 498 473 tsp->functions.set_config_option = smlTransportHttpClientSetConfigOption; 499 tsp->functions.initialize = smlTransportHttpClientInit;500 474 tsp->functions.set_response_uri = smlTransportHttpClientSetResponseURI; 501 475 tsp->functions.disconnect = smlTransportHttpClientDisconnect; trunk/tests/check_http.c
r511 r512 51 51 fail_unless(smlTransportSetConfigOption(tsp, "URL", "http://libsyncml.opensyncml.org", &error), NULL); 52 52 53 fail_unless(smlTransportInitialize(tsp, &error), NULL);54 fail_unless(error == NULL, NULL);53 fail_unless(smlTransportInitialize(tsp, &error), smlErrorPrint(&error)); 54 fail_unless(error == NULL, smlErrorPrint(&error)); 55 55 56 56 fail_unless(smlTransportFinalize(tsp, &error), NULL); … … 101 101 102 102 /* The transport is not configured but libsoup can initialize a default client */ 103 fail_unless(smlTransportInitialize(tsp, &error), NULL);104 fail_unless(error == NULL, NULL);103 fail_unless(smlTransportInitialize(tsp, &error), smlErrorPrint(&error)); 104 fail_unless(error == NULL, smlErrorPrint(&error)); 105 105 106 106 smlTransportFree(tsp); … … 136 136 fail_unless(error == NULL, NULL); 137 137 138 fail_unless(smlTransportInitialize(tsp, &error), NULL);139 fail_unless(error == NULL, NULL);138 fail_unless(smlTransportInitialize(tsp, &error), smlErrorPrint(&error)); 139 fail_unless(error == NULL, smlErrorPrint(&error)); 140 140 141 141 fail_unless(smlTransportFinalize(tsp, &error), NULL); … … 164 164 165 165 /* The default config of libsoup can be used to setup a valid transport. */ 166 fail_unless(smlTransportInitialize(tsp, &error), NULL);167 fail_unless(error == NULL, NULL);166 fail_unless(smlTransportInitialize(tsp, &error), smlErrorPrint(&error)); 167 fail_unless(error == NULL, smlErrorPrint(&error)); 168 168 169 169 smlTransportFree(tsp); … … 286 286 smlTransportSetEventCallback(client, _recv_client_event, GINT_TO_POINTER(1)); 287 287 288 fail_unless(smlTransportInitialize(client, &error), NULL);289 fail_unless(smlTransportInitialize(server, &error), NULL);288 fail_unless(smlTransportInitialize(client, &error), smlErrorPrint(&error)); 289 fail_unless(smlTransportInitialize(server, &error), smlErrorPrint(&error)); 290 290 291 291 fail_unless(smlTransportConnect(client, &error), NULL); … … 336 336 smlTransportSetEventCallback(client, _recv_client_event, GINT_TO_POINTER(1)); 337 337 338 fail_unless(smlTransportInitialize(client, &error), NULL);339 fail_unless(smlTransportInitialize(server, &error), NULL);338 fail_unless(smlTransportInitialize(client, &error), smlErrorPrint(&error)); 339 fail_unless(smlTransportInitialize(server, &error), smlErrorPrint(&error)); 340 340 341 341 SmlTransportData *data = smlTransportDataNew("test", 5, SML_MIMETYPE_XML, FALSE, &error); … … 389 389 smlTransportSetEventCallback(client, _recv_client_event, GINT_TO_POINTER(1)); 390 390 391 fail_unless(smlTransportInitialize(client, &error), NULL);392 fail_unless(smlTransportInitialize(server, &error), NULL);391 fail_unless(smlTransportInitialize(client, &error), smlErrorPrint(&error)); 392 fail_unless(smlTransportInitialize(server, &error), smlErrorPrint(&error)); 393 393 394 394 SmlTransportData *data = smlTransportDataNew("test", 5, SML_MIMETYPE_XML, FALSE, &error); … … 445 445 smlTransportSetEventCallback(server, _recv_server_event, GINT_TO_POINTER(1)); 446 446 447 fail_unless(smlTransportInitialize(client, &error), NULL);448 fail_unless(smlTransportInitialize(server, &error), NULL);447 fail_unless(smlTransportInitialize(client, &error), smlErrorPrint(&error)); 448 fail_unless(smlTransportInitialize(server, &error), smlErrorPrint(&error)); 449 449 450 450 SmlTransportData *data = smlTransportDataNew("test", 5, SML_MIMETYPE_XML, FALSE, &error); … … 504 504 smlTransportSetEventCallback(server, _recv_server_event, GINT_TO_POINTER(1)); 505 505 506 fail_unless(smlTransportInitialize(client, &error), NULL);507 fail_unless(smlTransportInitialize(server, &error), NULL);506 fail_unless(smlTransportInitialize(client, &error), smlErrorPrint(&error)); 507 fail_unless(smlTransportInitialize(server, &error), smlErrorPrint(&error)); 508 508 509 509 SmlTransportData *data = NULL; … … 562 562 smlTransportSetEventCallback(client, _recv_client_event, GINT_TO_POINTER(1)); 563 563 564 fail_unless(smlTransportInitialize(client, &error), NULL);564 fail_unless(smlTransportInitialize(client, &error), smlErrorPrint(&error)); 565 565 566 566 SmlTransportData *data = smlTransportDataNew("test", 5, SML_MIMETYPE_XML, FALSE, &error); … … 615 615 smlTransportSetEventCallback(server, _recv_server_event, GINT_TO_POINTER(2)); 616 616 617 fail_unless(smlTransportInitialize(client, &error), NULL);618 fail_unless(smlTransportInitialize(server, &error), NULL);617 fail_unless(smlTransportInitialize(client, &error), smlErrorPrint(&error)); 618 fail_unless(smlTransportInitialize(server, &error), smlErrorPrint(&error)); 619 619 620 620 SmlTransportData *data = smlTransportDataNew("test", 5, SML_MIMETYPE_XML, FALSE, &error); … … 864 864 smlTransportSetEventCallback(server, _recv_server_event, GINT_TO_POINTER(1)); 865 865 866 fail_unless(smlTransportInitialize(client1, &error), NULL);867 fail_unless(smlTransportInitialize(client2, &error), NULL);868 fail_unless(smlTransportInitialize(client3, &error), NULL);869 fail_unless(smlTransportInitialize(server, &error), NULL);866 fail_unless(smlTransportInitialize(client1, &error), smlErrorPrint(&error)); 867 fail_unless(smlTransportInitialize(client2, &error), smlErrorPrint(&error)); 868 fail_unless(smlTransportInitialize(client3, &error), smlErrorPrint(&error)); 869 fail_unless(smlTransportInitialize(server, &error), smlErrorPrint(&error)); 870 870 871 871 SmlTransportData *data = NULL;
