- Timestamp:
- Jun 17, 2009 1:31:13 PM (15 years ago)
- Location:
- pjproject/trunk/pjlib/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/ioqueue_symbian.cpp
r2481 r2771 214 214 aAddress_.SetAddress(0); 215 215 aAddress_.SetPort(0); 216 sock_->Socket().Recv(aBufferPtr_, flags, iStatus); 216 217 if (sock_->IsDatagram()) { 218 sock_->Socket().Recv(aBufferPtr_, flags, iStatus); 219 } else { 220 // Using static like this is not pretty, but we don't need to use 221 // the value anyway, hence doing it like this is probably most 222 // optimal. 223 static TSockXfrLength len; 224 sock_->Socket().RecvOneOrMore(aBufferPtr_, flags, iStatus, len); 225 } 217 226 } 218 227 … … 278 287 { 279 288 CPjSocket *pjNewSock = new CPjSocket(get_pj_socket()->GetAf(), 289 get_pj_socket()->GetSockType(), 280 290 blank_sock_); 281 291 int addrlen = 0; -
pjproject/trunk/pjlib/src/pj/os_symbian.h
r2481 r2771 55 55 56 56 // Construct CPjSocket 57 CPjSocket(int af, RSocket &sock) 58 : af_(af), sock_(sock), connected_(false), sockReader_(NULL) 57 CPjSocket(int af, int sock_type, RSocket &sock) 58 : af_(af), sock_(sock), sock_type_(sock_type), connected_(false), 59 sockReader_(NULL) 59 60 { 60 61 } … … 87 88 } 88 89 90 // Get socket type 91 int GetSockType() const 92 { 93 return sock_type_; 94 } 95 96 // Returns true if socket is a datagram 97 bool IsDatagram() const 98 { 99 return sock_type_ == KSockDatagram; 100 } 101 89 102 // Get socket reader, if any. 90 103 // May return NULL. … … 104 117 RSocket sock_; // Must not be reference, or otherwise 105 118 // it may point to local variable! 119 unsigned sock_type_; 120 106 121 bool connected_; 107 122 CPjSocketReader *sockReader_; -
pjproject/trunk/pjlib/src/pj/sock_symbian.cpp
r2481 r2771 126 126 void CPjSocketReader::ConstructL(unsigned max_len) 127 127 { 128 TProtocolDesc aProtocol; 129 TInt err; 130 131 err = sock_.Socket().Info(aProtocol); 132 User::LeaveIfError(err); 133 134 isDatagram_ = (aProtocol.iSockType == KSockDatagram); 128 isDatagram_ = sock_.IsDatagram(); 135 129 136 130 TUint8 *ptr = new TUint8[max_len]; … … 518 512 519 513 /* Wrap Symbian RSocket into PJLIB's CPjSocket, and return to caller */ 520 CPjSocket *pjSock = new CPjSocket(af, rSock);514 CPjSocket *pjSock = new CPjSocket(af, type, rSock); 521 515 *p_sock = (pj_sock_t)pjSock; 522 516 … … 734 728 735 729 CPjSocket *pjSock = (CPjSocket*)sock; 736 RSocket &rSock = pjSock->Socket();737 730 738 731 if (pjSock->Reader()) { … … 758 751 TPtr8 data((TUint8*)buf, (TInt)*len, (TInt)*len); 759 752 760 rSock.Recv(data, flags, reqStatus, recvLen); 753 if (pjSock->IsDatagram()) { 754 pjSock->Socket().Recv(data, flags, reqStatus); 755 } else { 756 // Using static like this is not pretty, but we don't need to use 757 // the value anyway, hence doing it like this is probably most 758 // optimal. 759 static TSockXfrLength len; 760 pjSock->Socket().RecvOneOrMore(data, flags, reqStatus, len); 761 } 761 762 User::WaitForRequest(reqStatus); 762 763 … … 998 999 999 1000 // Create PJ socket 1000 CPjSocket *newPjSock = new CPjSocket(pjSock->GetAf(), newSock); 1001 CPjSocket *newPjSock = new CPjSocket(pjSock->GetAf(), pjSock->GetSockType(), 1002 newSock); 1001 1003 newPjSock->SetConnected(true); 1002 1004 -
pjproject/trunk/pjlib/src/pjlib-test/activesock.c
r2394 r2771 213 213 for (i=0; i<10 && last_rx1 == srv1->rx_cnt && last_rx2 == srv2->rx_cnt; ++i) { 214 214 pj_time_val delay = {0, 10}; 215 #ifdef PJ_SYMBIAN 216 pj_symbianos_poll(-1, 100); 217 #else 215 218 pj_ioqueue_poll(ioqueue, &delay); 219 #endif 216 220 } 217 221 … … 404 408 if (status == PJ_EPENDING) { 405 409 do { 410 #if PJ_SYMBIAN 411 pj_symbianos_poll(-1, -1); 412 #else 406 413 pj_ioqueue_poll(ioqueue, NULL); 414 #endif 407 415 } while (!state2->sent); 408 } else if (status != PJ_SUCCESS) { 409 PJ_LOG(1,("", " err: send status=%d", status)); 410 status = -180; 411 break; 412 } else if (status == PJ_SUCCESS) { 413 if (len != sizeof(*pkt)) { 414 PJ_LOG(1,("", " err: shouldn't report partial sent")); 415 status = -190; 416 break; 417 } 416 } else { 417 #if PJ_SYMBIAN 418 /* The Symbian socket always returns PJ_SUCCESS for TCP send, 419 * eventhough the remote end hasn't received the data yet. 420 * If we continue sending, eventually send() will block, 421 * possibly because the send buffer is full. So we need to 422 * poll the ioqueue periodically, to let receiver gets the 423 * data. 424 */ 425 pj_symbianos_poll(-1, 0); 426 #endif 427 if (status != PJ_SUCCESS) { 428 PJ_LOG(1,("", " err: send status=%d", status)); 429 status = -180; 430 break; 431 } else if (status == PJ_SUCCESS) { 432 if (len != sizeof(*pkt)) { 433 PJ_LOG(1,("", " err: shouldn't report partial sent")); 434 status = -190; 435 break; 436 } 437 } 418 438 } 419 439 } … … 421 441 /* Wait until everything has been sent/received */ 422 442 if (state1->next_recv_seq < COUNT) { 443 #ifdef PJ_SYMBIAN 444 while (pj_symbianos_poll(-1, 1000) == PJ_TRUE) 445 ; 446 #else 423 447 pj_time_val delay = {0, 100}; 424 448 while (pj_ioqueue_poll(ioqueue, &delay) > 0) 425 449 ; 450 #endif 426 451 } 427 452
Note: See TracChangeset
for help on using the changeset viewer.