/[pengfork]/pengfork/src/prot30.c
ViewVC logotype

Diff of /pengfork/src/prot30.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by chupa, Mon Sep 2 14:47:53 2002 UTC revision 1.8 by nes, Tue Sep 3 16:40:34 2002 UTC
# Line 51  int server_lastseq; Line 51  int server_lastseq;
51    
52  buffer_t access_in, access_out, if_in, if_out;  buffer_t access_in, access_out, if_in, if_out;
53    
54  #define BUFFER_SIZE MAX_PACKET_SIZE*2   /* each buffer can handle 2 full packets */  /* each buffer can handle 2 full packets */
55    #define BUFFER_SIZE MAX_PACKET_SIZE*2
56    
57  #define WINDOW 10               /* Packet we can send/receive without ack */  #define WINDOW 10               /* Packet we can send/receive without ack */
58    
59  int  int
60  prot30_start ()  prot30_start ()
61  {  {
62    access_fd = access_getfd ();    if ((access_fd = access_getfd ()) < 0)
63    if_fd = if_getfd ();      {
64          fprintf (stderr, "Cound not open input device\n");
65          return 0;
66        }
67      if ((if_fd = if_getfd ()) < 0)
68        {
69          fprintf (stderr, "Could not open interface file descriptor\n");
70          return 0;
71        }
72    
73    client_seq = PACKET_MAX_SEQ;    client_seq = PACKET_MAX_SEQ;
74    server_lastack = 0;           /* We have never received a packet */    server_lastack = 0;           /* We have never received a packet */
# Line 113  prot30_loop () Line 122  prot30_loop ()
122    
123          case normal:          case normal:
124            FD_SET (access_fd, &rfdset);            FD_SET (access_fd, &rfdset);
           if (access_out.used > 0)  
             FD_SET (access_fd, &wfdset);  
125    
126            if (buffer_percent_free (&access_out) > 20)            if (buffer_percent_free (&access_out) > 20)
127              /* Make sure we have enough space for some ACK */              /* Make sure we have enough space for some ACK */
128              FD_SET (if_fd, &rfdset);              FD_SET (if_fd, &rfdset);
129    
130              if (access_out.used > 0)
131                FD_SET (access_fd, &wfdset);
132    
133            if (if_out.used > 0)            if (if_out.used > 0)
134              FD_SET (if_fd, &wfdset);              FD_SET (if_fd, &wfdset);
135    
# Line 131  prot30_loop () Line 142  prot30_loop ()
142            continue;            continue;
143          }          }
144    
145        tv.tv_sec = 10;           /* arbitrary value should be good */        tv.tv_sec = 30;           /* arbitrary value should be good */
146        tv.tv_usec = 0;        tv.tv_usec = 0;
147        timedout = 0;        timedout = 0;
148        fds = select (maxfd, &rfdset, &wfdset, &efdset, &tv);        fds = select (maxfd, &rfdset, &wfdset, &efdset, &tv);
# Line 149  prot30_loop () Line 160  prot30_loop ()
160    
161                if (FD_ISSET (if_fd, &rfdset))                if (FD_ISSET (if_fd, &rfdset))
162                  {                  {
163                      debug (5, "Read data from if_fd\n");
164                    buffer_recv (&if_in, if_fd);                    buffer_recv (&if_in, if_fd);
165                    prot30_send_ip ();                    prot30_send_ip ();
166                  }                  }
167    
168                if (FD_ISSET (if_fd, &wfdset))                if (FD_ISSET (if_fd, &wfdset))
169                  buffer_send (&if_out, if_fd);                  {
170                      debug (5, "Send data to if_fd\n");
171                      buffer_send (&if_out, if_fd);
172                    }
173              }              }
174            else            else
175              {              {

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26