remove obsolete timer
This commit is contained in:
parent
c6339bfd2d
commit
3fad9accbd
1 changed files with 7 additions and 11 deletions
|
@ -24,7 +24,7 @@
|
||||||
* This file is part of the lwIP TCP/IP stack.
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <metalsvm/stddef.h>
|
#include <metalsvm/stdlib.h>
|
||||||
|
|
||||||
#if defined(CONFIG_LWIP)
|
#if defined(CONFIG_LWIP)
|
||||||
|
|
||||||
|
@ -40,8 +40,7 @@
|
||||||
* a circular buffer until the first byte is non-zero, then it is to consume
|
* a circular buffer until the first byte is non-zero, then it is to consume
|
||||||
* another command/data pair.
|
* another command/data pair.
|
||||||
* If the command is "send", the server is to send "data length" bytes from a circular
|
* If the command is "send", the server is to send "data length" bytes from a circular
|
||||||
* buffer with the first byte being zero, until "some time" (6 seconds in the
|
* buffer with the first byte being zero, until "some time" and then send one final buffer with
|
||||||
* current netio126.zip download) has passed and then send one final buffer with
|
|
||||||
* the first byte being non-zero. Then it is to consume another command/data pair.
|
* the first byte being non-zero. Then it is to consume another command/data pair.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -156,7 +155,9 @@ netio_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||||
len = tcp_sndbuf(pcb);
|
len = tcp_sndbuf(pcb);
|
||||||
len = LWIP_MIN(len, ns->data_len - ns->cntr);
|
len = LWIP_MIN(len, ns->data_len - ns->cntr);
|
||||||
len = LWIP_MIN(len, NETIO_BUF_SIZE - ns->buf_pos);
|
len = LWIP_MIN(len, NETIO_BUF_SIZE - ns->buf_pos);
|
||||||
|
//kprintf("data length: %d, len: %d\n", ns->data_len, len);
|
||||||
|
|
||||||
|
ns->buf_ptr[0] = 0;
|
||||||
do {
|
do {
|
||||||
err = tcp_write(pcb, ns->buf_ptr + ns->buf_pos, len, TCP_WRITE_FLAG_COPY);
|
err = tcp_write(pcb, ns->buf_ptr + ns->buf_pos, len, TCP_WRITE_FLAG_COPY);
|
||||||
if (err == ERR_MEM) {
|
if (err == ERR_MEM) {
|
||||||
|
@ -216,7 +217,6 @@ netio_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||||
} else if (ns->state == NETIO_STATE_SEND_DATA
|
} else if (ns->state == NETIO_STATE_SEND_DATA
|
||||||
|| ns->state == NETIO_STATE_SEND_DATA_LAST) {
|
|| ns->state == NETIO_STATE_SEND_DATA_LAST) {
|
||||||
/* I don't think this should happen... */
|
/* I don't think this should happen... */
|
||||||
kputs("I don't think this should happen...\n");
|
|
||||||
} else {
|
} else {
|
||||||
/* done / quit */
|
/* done / quit */
|
||||||
netio_close(ns, pcb);
|
netio_close(ns, pcb);
|
||||||
|
@ -256,12 +256,8 @@ netio_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
|
||||||
ns->cntr = 0;
|
ns->cntr = 0;
|
||||||
|
|
||||||
/* check if timer expired */
|
/* check if timer expired */
|
||||||
if (get_clock_tick() - ns->time_stamp > 600) {
|
ns->buf_ptr[0] = 1;
|
||||||
ns->buf_ptr[0] = 1;
|
ns->state = NETIO_STATE_SEND_DATA_LAST;
|
||||||
ns->state = NETIO_STATE_SEND_DATA_LAST;
|
|
||||||
} else {
|
|
||||||
ns->buf_ptr[0] = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ns->state == NETIO_STATE_SEND_DATA_LAST || ns->state == NETIO_STATE_SEND_DATA){
|
if(ns->state == NETIO_STATE_SEND_DATA_LAST || ns->state == NETIO_STATE_SEND_DATA){
|
||||||
|
@ -291,6 +287,7 @@ netio_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
|
||||||
ns->state = NETIO_STATE_WAIT_FOR_CMD;
|
ns->state = NETIO_STATE_WAIT_FOR_CMD;
|
||||||
ns->cntr = 0;
|
ns->cntr = 0;
|
||||||
/* TODO LWIP_DEBUGF( print out some throughput calculation results... ); */
|
/* TODO LWIP_DEBUGF( print out some throughput calculation results... ); */
|
||||||
|
//kprintf("consumed ticks: %d", get_clock_tick() - ns->time_stamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
|
@ -345,7 +342,6 @@ netio_accept(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset(ns->buf_ptr, 0x00, NETIO_BUF_SIZE);
|
memset(ns->buf_ptr, 0x00, NETIO_BUF_SIZE);
|
||||||
//ns->buf_ptr[0] = 0;
|
|
||||||
|
|
||||||
tcp_arg(pcb, ns);
|
tcp_arg(pcb, ns);
|
||||||
tcp_sent(pcb, netio_sent);
|
tcp_sent(pcb, netio_sent);
|
||||||
|
|
Loading…
Add table
Reference in a new issue