sorry, my bad. i see it now. the problem is with the function that calls pj_sock_send.. but how about implementing true async event? i think in the udp case it should be simple: on incomming msg to send, if it not busy, schedule it the send, and if its busy, ignore the msg. on TCP, some q should be added. nir On Thu, Dec 10, 2009 at 9:21 AM, nir elkayam <nir.elkayam at gmail.com> wrote: > ok, i see what u mean. > > the call to the new "WaitForEvent" should be the last code in the > pj_sock_send() and no other code exept for error handeling should be there > like i see for example: > > > /* > * Send data > */ > PJ_DEF(pj_status_t) pj_sock_send(pj_sock_t sock, > const void *buf, > pj_ssize_t *len, > unsigned flags) > { > PJ_CHECK_STACK(); > PJ_ASSERT_RETURN(sock && buf && len, PJ_EINVAL); > > // Return failure if access point is marked as down by app. > PJ_SYMBIAN_CHECK_CONNECTION(); > > CPjSocket *pjSock = (CPjSocket*)sock; > RSocket &rSock = pjSock->Socket(); > > // send() should only be called to connected socket > PJ_ASSERT_RETURN(pjSock->IsConnected(), PJ_EINVALIDOP); > > TPtrC8 data((const TUint8*)buf, (TInt)*len); > TRequestStatus reqStatus; > TSockXfrLength sentLen; > > rSock.Send(data, flags, reqStatus, sentLen); > User::WaitForRequest(reqStatus); > > if (reqStatus.Int()==KErrNone) { > //*len = (TInt) sentLen.Length(); > return PJ_SUCCESS; > } else > return PJ_RETURN_OS_ERROR(reqStatus.Int()); > > } > > > On Thu, Dec 10, 2009 at 9:14 AM, Benny Prijono <bennylp at teluu.com> wrote: > >> On Thu, Dec 10, 2009 at 6:47 AM, nir elkayam <nir.elkayam at gmail.com> >> wrote: >> > hi benny, >> > >> > I see what u say but this issue will also raise with using regular async >> > events. >> >> The difference is, normally we would expect events to happen inside >> the "poll" function, and we can be sure that things are in good state >> before the events are executed. >> >> With the CActiveScheduler::Start() approach, now events can happen >> pretty much anywhere where this approach is used. Like I said, for >> example a timer event may elapse while we're inside pj_sock_send(), >> and this is bad. >> >> > is there anyway where u implement the PENDING state on send/sendto (i >> mean >> > other os.) >> > >> >> Async I/O is always done with ioqueue. >> >> Cheers >> Benny >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing list >> pjsip at lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> > > > > -- > ??? ?????? > ??: 050-3930056 > nir.elkayam at gmail.com > > -- ??? ?????? ??: 050-3930056 nir.elkayam at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20091210/5e9bfd81/attachment-0001.html>