home *** CD-ROM | disk | FTP | other *** search
- /* $Id: pendingwrites.c,v 1.2 1994/01/24 17:33:51 too Exp $
- *
- * Copyright (c) 1993 AmiTCP/IP Group <amitcp-group@hut.fi>
- *
- * Created: Wed Nov 10 13:10:28 1993 too
- * Last modified: Mon Jan 24 19:11:41 1994 too
- */
- {
- /*
- * There are some messages that aren't fully sent. Attempt to sent
- * rest of the message.
- */
- For_Each_List_Item(&writelist, struct PendingWrites *, pw, {
- int sent;
-
- if (FD_ISSET(pw->pw_Applport->ap_Sd, wfdsp)) {
- if ((sent = send(pw->pw_Applport->ap_Sd, pw->pw_Start,
- pw->pw_Left, 0)) == pw->pw_Left) {
- /*
- * If all remaining bytes were sent, this pw node becomes
- * obsolete and it is moved to free writes list.
- */
- ReplyPkt(pw->pw_Packet, pw->pw_Len, 0);
- goto clear;
- }
- else {
- if (sent == -1)
- if (Errno() != EWOULDBLOCK) {
- ReplyPkt(pw->pw_Packet, -1, 0); /* -1 == EOF in Write() */
- goto clear;
- }
- else /* set sent to 0 */
- continue;
- pw->pw_Start += sent;
- pw->pw_Left -= sent;
- }
- }
- continue;
- clear:
- writespending--; /* identical code 2 times */
- FD_CLR(pw->pw_Applport->ap_Sd, &writefds);
- pw->pw_Applport->ap_Pw = NULL;
-
- Remove(&pw->pw_Link);
- AddTail((struct List *)&freewritelist, &pw->pw_Link);
- });
- }
-