From: <svn...@op...> - 2009-03-25 10:57:00
|
Author: bellmich Date: Wed Mar 25 11:56:56 2009 New Revision: 1016 URL: http://libsyncml.opensync.org/changeset/1016 Log: only HTTP client transport needs a running thread during finalize Modified: trunk/libsyncml/sml_transport.c Modified: trunk/libsyncml/sml_transport.c ============================================================================== --- trunk/libsyncml/sml_transport.c Wed Mar 25 09:55:10 2009 (r1015) +++ trunk/libsyncml/sml_transport.c Wed Mar 25 11:56:56 2009 (r1016) @@ -1087,18 +1087,32 @@ goto error; } + /* FIXME: Is there a situation where no thread is present? */ + if (tsp->type != SML_TRANSPORT_HTTP_CLIENT && tsp->thread) + _smlTransportStop(tsp); + /* give all jobs a chance to finish cleanly */ smlQueueDetach(tsp->command_queue); int i = 0; unsigned int queueLength = smlQueueLength(tsp->command_queue); for (; i < queueLength; i++) { - if (!smlThreadCallFunction(tsp->thread, smlTransportDispatchQueueCallback, tsp->command_queue, error)) - goto error; + if (tsp->thread) { + /* HTTP client only */ + if (!smlThreadCallFunction( + tsp->thread, + smlTransportDispatchQueueCallback, + tsp->command_queue, + error)) + goto error; + } else { + smlQueueDispatch(tsp->command_queue); + } } if (!tsp->functions.finalize(tsp->transport_data, error)) goto error; + /* HTTP client only */ if (tsp->thread) _smlTransportStop(tsp); |