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

Diff of /pengfork/src/p3/p3.c

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

revision 1.7 by chupa, Tue Sep 10 13:17:22 2002 UTC revision 1.8 by chupa, Wed Sep 11 15:39:32 2002 UTC
# Line 47  struct p3state cli, srv; Line 47  struct p3state cli, srv;
47  const protocol_t p3_protocol = (protocol_t) {  const protocol_t p3_protocol = (protocol_t) {
48    p3_register_to_engine,    p3_register_to_engine,
49    p3_send,    p3_send,
50      p3_ready,
51    (P3_MAX_SIZE - P3_DATA_OFFSET - 1)    (P3_MAX_SIZE - P3_DATA_OFFSET - 1)
52  };  };
53    
# Line 56  const struct engine_functions p3_fn = (s Line 57  const struct engine_functions p3_fn = (s
57    p3_want_write,    p3_want_write,
58    p3_recv,    p3_recv,
59    NULL,    NULL,
60    NULL,    p3_timeout,
61    NULL    NULL
62  };  };
63    
# Line 67  p3_register_to_engine (myaccess) Line 68  p3_register_to_engine (myaccess)
68       const access_t *myaccess;       const access_t *myaccess;
69  {  {
70    if (myaccess->is_connected ())    if (myaccess->is_connected ())
71      engine_register (*(myaccess->fd), p3_fn);      engine_register (*(myaccess->fd),P3_TIMEOUT , p3_fn);
72    else    else
73      log (LOG_ERR,      log (LOG_ERR,
74           "P3 - Unable to register functions, access is not connected\n");           "P3 - Unable to register functions, access is not connected\n");
75  }  }
76    
77    int
78    p3_ready()
79    {
80      return !win_full(&wsend);
81    }
82    
83  void  void
84  p3_init (bufin, bufout)  p3_init (bufin, bufout)
85       buffer_t *bufin;       buffer_t *bufin;
# Line 137  p3_recv (bufin) Line 144  p3_recv (bufin)
144          }          }
145      }      }
146  }  }
147    
148    void
149    p3_timeout(bufin, bufout, timeout)
150         buffer_t *bufin;
151         buffer_t *bufout;
152         int timeout;
153    {
154      debug(1,"P3 - timeout notified\n");
155      if(timeout<10)
156        {
157          if(srv.lastseq != cli.lastack)
158            {
159            /* Server has some unacknowledged packets */
160            p3_put_packet(TYPE_ACK,NULL,0);
161            }
162        }
163      else if(timeout < 15)
164        {
165          if(cli.lastseq != srv.lastack)
166            {
167            /* we have some unacknowledged packets */
168            p3_put_packet(TYPE_PING,NULL,0);
169            }
170        }
171      else if(timeout < 35)
172        {
173          if(cli.lastseq != srv.lastack)
174            {
175            /* we have some unacknowledged packets */
176            p3_put_packet(TYPE_PING,NULL,0);
177            }
178        }
179      else
180        {
181          if(cli.lastseq != srv.lastack)
182            {
183            /* Always some unacknowledged packets??!!
184             * The server seems out or lost
185             */
186            
187            }
188        }
189    }

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