PR_LOG(_pr_io_lm, PR_LOG_MAX, ("recv: fd=%p osfd=%d buf=%p amount=%d", fd, fd->secret->md.osfd, buf, amount));
PR_LOG(_pr_io_lm, PR_LOG_MAX, ("recv: fd=%p osfd=%d buf=%p amount=%d flags=%d", fd, fd->secret->md.osfd, buf, amount, flags));  #ifdef _PR_HAVE_PEEK_BUFFER if (fd->secret->peekBytes != 0) { rv = (amount < fd->secret->peekBytes) ? amount : fd->secret->peekBytes; memcpy(buf, fd->secret->peekBuffer, rv); if (flags == 0) {  fd->secret->peekBytes -= rv; if (fd->secret->peekBytes != 0) { memmove(fd->secret->peekBuffer, fd->secret->peekBuffer + rv, fd->secret->peekBytes); } } return rv; }   if ((PR_MSG_PEEK == flags) && _PR_FD_NEED_EMULATE_MSG_PEEK(fd)) { PR_ASSERT(0 == fd->secret->peekBytes);  if (amount > _PR_PEEK_BUFFER_MAX) { amount = _PR_PEEK_BUFFER_MAX; } if (fd->secret->peekBufSize < amount) { if (fd->secret->peekBuffer) { PR_Free(fd->secret->peekBuffer); } fd->secret->peekBufSize = amount; fd->secret->peekBuffer = PR_Malloc(amount); if (NULL == fd->secret->peekBuffer) { fd->secret->peekBufSize = 0; PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); return -1; } } } #endif
static PRInt32 PR_CALLBACK SocketRecv(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags,PRIntervalTime timeout){	PRInt32 rv;	PRThread *me = _PR_MD_CURRENT_THREAD();	if (_PR_PENDING_INTERRUPT(me)) {		me->flags &= ~_PR_INTERRUPT;		PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0);		return -1;	}	if (_PR_IO_PENDING(me)) {		PR_SetError(PR_IO_PENDING_ERROR, 0);		return -1;	}	PR_LOG(_pr_io_lm, PR_LOG_MAX, ("recv: fd=%p osfd=%d buf=%p amount=%d",		    						fd, fd->secret->md.osfd, buf, amount));	rv = _PR_MD_RECV(fd, buf, amount, flags, timeout);	PR_LOG(_pr_io_lm, PR_LOG_MAX, ("recv -> %d, error = %d, os error = %d",		rv, PR_GetError(), PR_GetOSError()));	return rv;}