summaryrefslogtreecommitdiff
path: root/pjlib/src
diff options
context:
space:
mode:
Diffstat (limited to 'pjlib/src')
-rw-r--r--pjlib/src/pj/ioqueue_symbian.cpp8
-rw-r--r--pjlib/src/pj/os_core_symbian.cpp5
-rw-r--r--pjlib/src/pj/os_symbian.h8
-rw-r--r--pjlib/src/pj/sock_symbian.cpp19
-rw-r--r--pjlib/src/pj/timer_symbian.cpp6
5 files changed, 33 insertions, 13 deletions
diff --git a/pjlib/src/pj/ioqueue_symbian.cpp b/pjlib/src/pj/ioqueue_symbian.cpp
index 6768cc01..73f0f04a 100644
--- a/pjlib/src/pj/ioqueue_symbian.cpp
+++ b/pjlib/src/pj/ioqueue_symbian.cpp
@@ -648,6 +648,10 @@ PJ_DEF(pj_status_t) pj_ioqueue_recv( pj_ioqueue_key_t *key,
pj_ssize_t *length,
pj_uint32_t flags )
{
+ // If socket has reader, delete it.
+ if (key->cbObj->get_pj_socket()->Reader())
+ key->cbObj->get_pj_socket()->DestroyReader();
+
// Clear flag
flags &= ~PJ_IOQUEUE_ALWAYS_ASYNC;
return key->cbObj->StartRead(op_key, buffer, length, flags, NULL, NULL);
@@ -667,6 +671,10 @@ PJ_DEF(pj_status_t) pj_ioqueue_recvfrom( pj_ioqueue_key_t *key,
pj_sockaddr_t *addr,
int *addrlen)
{
+ // If socket has reader, delete it.
+ if (key->cbObj->get_pj_socket()->Reader())
+ key->cbObj->get_pj_socket()->DestroyReader();
+
if (key->cbObj->IsActive())
return PJ_EBUSY;
diff --git a/pjlib/src/pj/os_core_symbian.cpp b/pjlib/src/pj/os_core_symbian.cpp
index a55b548a..742fe5ab 100644
--- a/pjlib/src/pj/os_core_symbian.cpp
+++ b/pjlib/src/pj/os_core_symbian.cpp
@@ -421,6 +421,11 @@ PJ_DEF(pj_status_t) pj_thread_destroy(pj_thread_t *rec)
PJ_DEF(pj_status_t) pj_thread_sleep(unsigned msec)
{
User::After(msec*1000);
+
+ TInt aError;
+ while (CActiveScheduler::RunIfReady(aError, EPriorityMuchLess))
+ ;
+
return PJ_SUCCESS;
}
diff --git a/pjlib/src/pj/os_symbian.h b/pjlib/src/pj/os_symbian.h
index 929070b3..a1977871 100644
--- a/pjlib/src/pj/os_symbian.h
+++ b/pjlib/src/pj/os_symbian.h
@@ -86,6 +86,9 @@ public:
// Create socket reader.
CPjSocketReader *CreateReader(unsigned max_len=CPjSocket::MAX_LEN);
+ // Delete socket reader when it's not wanted.
+ void DestroyReader();
+
private:
RSocket sock_; // Must not be reference, or otherwise
// it may point to local variable!
@@ -187,11 +190,6 @@ class PjSymbianOS
{
public:
//
- // Construct PjSymbianOS instance.
- //
- static PjSymbianOS *NewL();
-
- //
// Get the singleton instance of PjSymbianOS
//
static PjSymbianOS *Instance();
diff --git a/pjlib/src/pj/sock_symbian.cpp b/pjlib/src/pj/sock_symbian.cpp
index 8d2ab077..ae691bae 100644
--- a/pjlib/src/pj/sock_symbian.cpp
+++ b/pjlib/src/pj/sock_symbian.cpp
@@ -66,12 +66,7 @@ const pj_uint16_t PJ_SO_SNDBUF = 0xFFFF;
CPjSocket::~CPjSocket()
{
- if (sockReader_) {
- if (sockReader_->IsActive())
- sockReader_->Cancel();
- delete sockReader_;
- sockReader_ = NULL;
- }
+ DestroyReader();
sock_.Close();
}
@@ -83,6 +78,17 @@ CPjSocketReader *CPjSocket::CreateReader(unsigned max_len)
return sockReader_ = CPjSocketReader::NewL(*this, max_len);
}
+// Delete socket reader when it's not wanted.
+void CPjSocket::DestroyReader()
+{
+ if (sockReader_) {
+ if (sockReader_->IsActive())
+ sockReader_->Cancel();
+ delete sockReader_;
+ sockReader_ = NULL;
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////
//
@@ -163,7 +169,6 @@ void CPjSocketReader::RunL()
{
void (*old_cb)(void *key) = readCb_;
void *old_key = key_;
- bool is_active = IsActive();
readCb_ = NULL;
key_ = NULL;
diff --git a/pjlib/src/pj/timer_symbian.cpp b/pjlib/src/pj/timer_symbian.cpp
index 398f7722..eaf4f9ed 100644
--- a/pjlib/src/pj/timer_symbian.cpp
+++ b/pjlib/src/pj/timer_symbian.cpp
@@ -88,7 +88,11 @@ void CPjTimerEntry::ConstructL(const pj_time_val *delay)
rtimer_.CreateLocal();
CActiveScheduler::Add(this);
- rtimer_.After(iStatus, PJ_TIME_VAL_MSEC(*delay) * 1000);
+ pj_int32_t interval = PJ_TIME_VAL_MSEC(*delay) * 1000;
+ if (interval < 0) {
+ interval = 0;
+ }
+ rtimer_.After(iStatus, interval);
SetActive();
}