Registration failed for TCP connection in symbian (carbide C++ 1.3) emulator.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Benny ,

Regarding the TCP issue, I have a solution. With the below changes,
registartion is working fine. However, I am not aware of the impact on other
modules. Please let me know if this is a proper fix or it adversely affects
any other functionality.

This code change is made on Release 1.1.

60  //
61    // Start asynchronous accept() operation.
62    //
63    pj_status_t StartAccept(pj_ioqueue_op_key_t *op_key,
64       pj_sock_t *new_sock,
65       pj_sockaddr_t *local,
66       pj_sockaddr_t *remote,
67       int *addrlen );

+    //  Start asynchronous connect() operation
+    pj_status_t StartConnect(pj_ioqueue_key_t *key,
+                const pj_sockaddr_t *addr,
+                int addrlen  );
+

 private:
     // Type of pending operation.
     enum Type {
108  TYPE_NONE,
109   TYPE_READ,
110   TYPE_ACCEPT,
+   TYPE_CONNECT
     };




215
216 -  sock_->Socket().Recv(aBufferPtr_, flags, iStatus);  static
    + TSockXfrLength len;  sock_->Socket().RecvOneOrMore(aBufferPtr_, flags,
iStatus, len);
     }




254
+//
+// Start asynchronous connect() operation.
+//

+
+pj_status_t CIoqueueCallback::StartConnect(pj_ioqueue_key_t *key,
+            const pj_sockaddr_t *addr,
+            int addrlen  )
+{
+  pj_status_t status;
+
+
+      TInetAddr inetAddr;
+      TRequestStatus reqStatus;
+
+      // Convert address
+      status = PjSymbianOS::pj2Addr(*(const pj_sockaddr*)addr,
addrlen,inetAddr);
+      if (status != PJ_SUCCESS)
+        return status;
+
+
+      type_ = TYPE_CONNECT;
+      sock_->Socket().Connect(inetAddr,iStatus);
+      blank_sock_.Open(PjSymbianOS::Instance()->SocketServ());
+
+
+      SetActive();
+      if (iStatus == KErrNone)
+        {
+
+          return PJ_SUCCESS;
+         // sock_->Socket.SetConnected(true);
+        }
+      return PJ_RETURN_OS_ERROR(reqStatus.Int());
+}


385        // Call callback.
386 if (cb_.on_accept_complete) {
387     cb_.on_accept_complete( key_, op_key, (pj_sock_t)pjNewSock,
388        PJ_SUCCESS);
389 }
390    }

+      else if (cur_type == TYPE_CONNECT){
+      pj_ioqueue_op_key_t *op_key = pending_data_.read_.op_key_;
+      pending_data_.read_.op_key_ = NULL;
+      // Handle failure condition
+        if (iStatus != KErrNone) {
+          //  if (pending_data_.connect_.new_sock_)
+          //*pending_data_.connect_.new_sock_ = PJ_INVALID_SOCKET;
+
+            if (cb_.on_connect_complete) {
+              cb_.on_connect_complete(
key_,-PJ_RETURN_OS_ERROR(iStatus.Int()));
+            }
+        }
+       // CPjSocket *pjNewSock = HandleAcceptCompletion();
+
+          // Call callback.
+          if (cb_.on_connect_complete) {
+              cb_.on_connect_complete( key_,
+                    PJ_SUCCESS);
+          }
+
+    }

392    ioqueue_->eventCount++;
 }


   * Initiate non-blocking socket connect.
   */
628 PJ_DEF(pj_status_t) pj_ioqueue_connect( pj_ioqueue_key_t *key,
629     const pj_sockaddr_t *addr,
     int addrlen )
   {
-    pj_status_t status;
+  return  key->cbObj->StartConnect(key,addr,addrlen);

-    RSocket &rSock = key->cbObj->get_pj_socket()->Socket();
-    TInetAddr inetAddr;
-    TRequestStatus reqStatus;
-
-    // Return failure if access point is marked as down by app.
-    PJ_SYMBIAN_CHECK_CONNECTION();
-
-    // Convert address
-    status = PjSymbianOS::pj2Addr(*(const pj_sockaddr*)addr, addrlen,
-          inetAddr);
-    if (status != PJ_SUCCESS)
-     return status;
-
-    // We don't support async connect for now.
-    PJ_TODO(IOQUEUE_SUPPORT_ASYNC_CONNECT);
-
-    rSock.Connect(inetAddr, reqStatus);
-    User::WaitForRequest(reqStatus);
-
-    if (reqStatus == KErrNone)
- return PJ_SUCCESS;
-
-    return PJ_RETURN_OS_ERROR(reqStatus.Int());
 }

 Regards
 Vinay N



2009/3/20 Benny Prijono <bennylp at teluu.com>

> 2009/3/19 chittaranjan rao <chittaranjanrao at hotmail.com>
>
>> Hi Benny,
>>
>>      I saw the changes made for the fix and I shall test it. Being new to
>> Symbian, I do not understand all the changes made, but I will definetly test
>> it and let you know the results.
>>
>>
>
> It probably won't work. The patch attached to the ticket does not yet solve
> the problem.
>
> cheers
>  Benny
>
>
>       Thanks for looking into the issue !
>>
>> Regards,
>> Chittaranjan
>>
>
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090410/d7ce5c75/attachment-0001.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux