More fixes for tcp
This commit is contained in:
parent
abdf9e2cfe
commit
c297c13c5e
@ -82,6 +82,7 @@ unsigned int socket_accept(unsigned int socket, struct inet_addr *clientaddr) {
|
|||||||
unsigned int ret;
|
unsigned int ret;
|
||||||
__asm__ volatile ("int $0x30" : "=a" (ret) : "0" (40), "b" (socket), "c" (clientaddr));
|
__asm__ volatile ("int $0x30" : "=a" (ret) : "0" (40), "b" (socket), "c" (clientaddr));
|
||||||
while (ret == 0) {
|
while (ret == 0) {
|
||||||
|
__asm__ volatile ("int $0x30" : "=a" (ret) : "0" (23)); // yield
|
||||||
__asm__ volatile ("int $0x30" : "=a" (ret) : "0" (40), "b" (socket), "c" (clientaddr));
|
__asm__ volatile ("int $0x30" : "=a" (ret) : "0" (40), "b" (socket), "c" (clientaddr));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -206,6 +206,9 @@ void sched_free_task(struct task_t *this_task) {
|
|||||||
|
|
||||||
while (ptr_vector_len(&this_task->sockets)) {
|
while (ptr_vector_len(&this_task->sockets)) {
|
||||||
struct socket_t *s = ptr_vector_del(&this_task->sockets, 0);
|
struct socket_t *s = ptr_vector_del(&this_task->sockets, 0);
|
||||||
|
if (s->status == SOCKET_STATUS_CLOSEWAIT) {
|
||||||
|
s->status = SOCKET_STATUS_CLOSE;
|
||||||
|
}
|
||||||
socket_close(s->serial);
|
socket_close(s->serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,9 +242,6 @@ void syscall_isr(struct regs *r) {
|
|||||||
break;
|
break;
|
||||||
case SYS_SOCK_READ:
|
case SYS_SOCK_READ:
|
||||||
r->eax = socket_read(r->ebx, (char *)r->ecx, r->edx);
|
r->eax = socket_read(r->ebx, (char *)r->ecx, r->edx);
|
||||||
if (r->eax == -1) {
|
|
||||||
schedule(r);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SYS_SOCK_WRITE:
|
case SYS_SOCK_WRITE:
|
||||||
r->eax = socket_write(r->ebx, (unsigned char *)r->ecx, r->edx);
|
r->eax = socket_write(r->ebx, (unsigned char *)r->ecx, r->edx);
|
||||||
@ -254,9 +251,6 @@ void syscall_isr(struct regs *r) {
|
|||||||
break;
|
break;
|
||||||
case SYS_SOCK_ACCEPT:
|
case SYS_SOCK_ACCEPT:
|
||||||
r->eax = (unsigned int)socket_accept(r->ebx, (struct inet_addr *)r->ecx);
|
r->eax = (unsigned int)socket_accept(r->ebx, (struct inet_addr *)r->ecx);
|
||||||
if (r->eax == 0) {
|
|
||||||
schedule(r);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SYS_MEM_INFO:
|
case SYS_MEM_INFO:
|
||||||
r->eax = mem_get_info((struct mem_info *)r->ebx);
|
r->eax = mem_get_info((struct mem_info *)r->ebx);
|
||||||
|
5
tcp.c
5
tcp.c
@ -192,7 +192,10 @@ void tcp_process_packet(struct ether_t *ether, unsigned int dest, unsigned int s
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sock->send_payload = 1;
|
sock->send_payload = 1;
|
||||||
if (sock->status != SOCKET_STATUS_FINACK) {
|
if (sock->status == SOCKET_STATUS_FINACK) {
|
||||||
|
sock->status = SOCKET_STATUS_CLOSE;
|
||||||
|
socket_doclose(sock);
|
||||||
|
} else {
|
||||||
tcp_process_socket(sock);
|
tcp_process_socket(sock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user