Ticket #758: pjlib-test.diff
File pjlib-test.diff, 4.6 KB (added by bennylp, 15 years ago) |
---|
-
pjlib/src/pj/ioqueue_symbian.cpp
213 213 } else { 214 214 aAddress_.SetAddress(0); 215 215 aAddress_.SetPort(0); 216 sock_->Socket().Recv(aBufferPtr_, flags, iStatus); 216 217 //sock_->Socket().Recv(aBufferPtr_, flags, iStatus); 218 static TSockXfrLength len; 219 sock_->Socket().RecvOneOrMore(aBufferPtr_, flags, iStatus, len); 217 220 } 218 221 219 222 SetActive(); -
pjlib/src/pjlib-test/main_symbian.cpp
44 44 LOCAL_D CConsoleBase* console; // write all messages to this 45 45 46 46 47 // Local Functions48 49 LOCAL_C void MainL()50 {51 //52 // add your program code here, example code below53 //54 test_main();55 56 console->Printf(_L(" [press any key]\n"));57 console->Getch();58 59 CActiveScheduler::Stop();60 }61 62 47 class MyScheduler : public CActiveScheduler 63 48 { 64 49 public: … … 73 58 PJ_UNUSED_ARG(aError); 74 59 } 75 60 76 class ProgramStarter : public CActive77 {78 public:79 static ProgramStarter *NewL();80 void Start();81 82 protected:83 ProgramStarter();84 void ConstructL();85 virtual void RunL();86 virtual void DoCancel();87 TInt RunError(TInt aError);88 89 private:90 RTimer timer_;91 };92 93 ProgramStarter::ProgramStarter()94 : CActive(EPriorityNormal)95 {96 }97 98 void ProgramStarter::ConstructL()99 {100 timer_.CreateLocal();101 CActiveScheduler::Add(this);102 }103 104 ProgramStarter *ProgramStarter::NewL()105 {106 ProgramStarter *self = new (ELeave) ProgramStarter;107 CleanupStack::PushL(self);108 109 self->ConstructL();110 111 CleanupStack::Pop(self);112 return self;113 }114 115 void ProgramStarter::Start()116 {117 timer_.After(iStatus, 0);118 SetActive();119 }120 121 void ProgramStarter::RunL()122 {123 MainL();124 }125 126 void ProgramStarter::DoCancel()127 {128 }129 130 TInt ProgramStarter::RunError(TInt aError)131 {132 PJ_UNUSED_ARG(aError);133 return KErrNone;134 }135 136 137 61 LOCAL_C void DoStartL() 138 62 { 139 63 // Create active scheduler (to run active objects) … … 141 65 CleanupStack::PushL(scheduler); 142 66 CActiveScheduler::Install(scheduler); 143 67 144 ProgramStarter *starter = ProgramStarter::NewL(); 145 starter->Start(); 68 test_main(); 146 69 147 CActiveScheduler::Start(); 70 CActiveScheduler::Install(NULL); 71 CleanupStack::Pop(scheduler); 72 delete scheduler; 148 73 } 149 74 150 75 … … 180 105 TRAPD(mainError, DoStartL()); 181 106 if (mainError) 182 107 console->Printf(_L(" failed, leave code = %d"), mainError); 108 183 109 console->Printf(_L(" [press any key]\n")); 184 110 console->Getch(); 185 111 186 112 delete console; 187 113 delete cleanup; 114 115 CloseSTDLIB(); 116 188 117 __UHEAP_MARKEND; 118 189 119 return KErrNone; 190 120 } 191 121 -
pjlib/src/pjlib-test/activesock.c
212 212 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 218 222 if (srv1->rx_err_cnt+srv1->tx_err_cnt != 0 || … … 403 407 status = pj_activesock_send(asock2, &op_key->op_key, pkt, &len, 0); 404 408 if (status == PJ_EPENDING) { 405 409 do { 410 #ifdef 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 416 } else if (status != PJ_SUCCESS) { 409 417 PJ_LOG(1,("", " err: send status=%d", status)); … … 420 428 421 429 /* Wait until everything has been sent/received */ 422 430 if (state1->next_recv_seq < COUNT) { 431 #ifdef PJ_SYMBIAN 432 while (pj_symbianos_poll(-1, 1000) == PJ_TRUE) 433 ; 434 #else 423 435 pj_time_val delay = {0, 100}; 424 436 while (pj_ioqueue_poll(ioqueue, &delay) > 0) 425 437 ; 438 #endif 426 439 } 427 440 428 441 if (status == PJ_EPENDING) -
pjlib/src/pjlib-test/test.c
197 197 PJ_LOG(3,("test", "Looks like everything is okay!..")); 198 198 else 199 199 PJ_LOG(3,("test", "Test completed with error(s)")); 200 201 pj_shutdown(); 202 200 203 return 0; 201 204 }