Changeset 2187 for pjproject/trunk/pjlib/src/pj/activesock.c
- Timestamp:
- Aug 4, 2008 9:59:02 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/activesock.c
r2185 r2187 18 18 */ 19 19 #include <pj/activesock.h> 20 #include <pj/compat/socket.h> 20 21 #include <pj/assert.h> 21 22 #include <pj/errno.h> … … 242 243 pj_uint32_t flags) 243 244 { 245 void **readbuf; 246 unsigned i; 247 248 PJ_ASSERT_RETURN(asock && pool && buff_size, PJ_EINVAL); 249 250 readbuf = (void**) pj_pool_calloc(pool, asock->async_count, 251 sizeof(void*)); 252 253 for (i=0; i<asock->async_count; ++i) { 254 readbuf[i] = pj_pool_alloc(pool, buff_size); 255 } 256 257 return pj_activesock_start_read2(asock, pool, buff_size, readbuf, flags); 258 } 259 260 261 PJ_DEF(pj_status_t) pj_activesock_start_read2( pj_activesock_t *asock, 262 pj_pool_t *pool, 263 unsigned buff_size, 264 void *readbuf[], 265 pj_uint32_t flags) 266 { 244 267 unsigned i; 245 268 pj_status_t status; … … 259 282 pj_ssize_t size_to_read; 260 283 261 r->pkt = (pj_uint8_t*) pj_pool_alloc(pool, buff_size);284 r->pkt = (pj_uint8_t*)readbuf[i]; 262 285 r->max_size = size_to_read = buff_size; 263 286 … … 278 301 unsigned buff_size, 279 302 pj_uint32_t flags) 303 { 304 void **readbuf; 305 unsigned i; 306 307 PJ_ASSERT_RETURN(asock && pool && buff_size, PJ_EINVAL); 308 309 readbuf = (void**) pj_pool_calloc(pool, asock->async_count, 310 sizeof(void*)); 311 312 for (i=0; i<asock->async_count; ++i) { 313 readbuf[i] = pj_pool_alloc(pool, buff_size); 314 } 315 316 return pj_activesock_start_recvfrom2(asock, pool, buff_size, 317 readbuf, flags); 318 } 319 320 321 PJ_DEF(pj_status_t) pj_activesock_start_recvfrom2( pj_activesock_t *asock, 322 pj_pool_t *pool, 323 unsigned buff_size, 324 void *readbuf[], 325 pj_uint32_t flags) 280 326 { 281 327 unsigned i; … … 295 341 pj_ssize_t size_to_read; 296 342 297 r->pkt = (pj_uint8_t*) pj_pool_alloc(pool, buff_size);343 r->pkt = (pj_uint8_t*) readbuf[i]; 298 344 r->max_size = size_to_read = buff_size; 299 345 r->src_addr_len = sizeof(r->src_addr); … … 372 418 } 373 419 374 } else if (bytes_read <= 0) { 375 420 } else if (bytes_read <= 0 && 421 -bytes_read != PJ_STATUS_FROM_OS(OSERR_EWOULDBLOCK) && 422 -bytes_read != PJ_STATUS_FROM_OS(OSERR_EINPROGRESS) && 423 -bytes_read != PJ_STATUS_FROM_OS(OSERR_ECONNRESET)) 424 { 376 425 pj_size_t remainder; 377 426 pj_bool_t ret;
Note: See TracChangeset
for help on using the changeset viewer.