- if (!node)
- return FALSE;
-
- SockRequest *req = (SockRequest *)node->Data();
-
- delete node;
-
- switch (req->type) {
- case EVT_READ:
- case EVT_PEEK:
- ret = recv(m_fd, req->buffer, req->size,
- (req->type == EVT_PEEK) ? MSG_PEEK : 0);
- if (ret < 0) {
- req->error = errno;
- req->done = TRUE;
- break;
- }
- len = ret;
- if ((len < req->size) && (m_flags & WAITALL)) {
- req->size -= len;
- req->nbytes += len;
- req->buffer += len;
- req->auto_wakeup->Start(m_timeout*1000, TRUE);
- req_list[req_flag].Insert(req);
- break;
- }
- req->done = TRUE;
- req->nbytes += len;
-#ifndef __WXGTK__
- DestroyCallbacks();
-#endif
- break;
- case EVT_WRITE:
- ret = send(m_fd, req->buffer, req->size, 0);
- if (ret < 0) {
- req->error = errno;
- req->done = TRUE;
- break;
- }
- len = ret;
- if ((len < req->size) && (m_flags & WAITALL)) {
- req->size -= len;
- req->nbytes += len;
- req->buffer += len;
- req->auto_wakeup->Start(m_timeout*1000, TRUE);
- req_list[req_flag].Insert(req);
- break;
- }
- req->done = TRUE;
- req->nbytes += len;
-#ifndef __WXGTK__
- DestroyCallbacks();
-#endif
- break;
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-void wxSocketBase::WantSpeedBuffer(char *buffer, size_t nbytes,
- wxRequestEvent evt)
-{
- int ret = 0;
-
- switch (evt) {
- case EVT_PEEK:
- case EVT_READ:
- ret = recv(m_fd, buffer, nbytes,
- (evt == EVT_PEEK) ? MSG_PEEK : 0);
- break;
- case EVT_WRITE:
- ret = send(m_fd, buffer, nbytes, 0);
- break;
- }
- if (ret < 0) {
- m_lcount = 0;
- m_error = errno;
- } else {
- m_lcount = ret;
- m_error = 0;
- }
-}
-
-void wxSocketBase::WantBuffer(char *buffer, size_t nbytes,
- wxRequestEvent evt)