diff --git a/sys/net/destiny/destiny.c b/sys/net/destiny/destiny.c index 86a9746dab..6a088ba085 100644 --- a/sys/net/destiny/destiny.c +++ b/sys/net/destiny/destiny.c @@ -66,7 +66,7 @@ int destiny_init_transport_layer(void) PRIORITY_MAIN, CREATE_STACKTEST, tcp_packet_handler, "tcp_packet_handler"); - if (udp_thread_pid < 0) { + if (tcp_thread_pid < 0) { return -1; } diff --git a/sys/net/destiny/socket.c b/sys/net/destiny/socket.c index cce6e8fe52..101d2b92ff 100644 --- a/sys/net/destiny/socket.c +++ b/sys/net/destiny/socket.c @@ -999,15 +999,15 @@ int32_t destiny_socket_recvfrom(int s, void *buf, uint32_t len, int flags, payload = (uint8_t *)(m_recv.content.ptr + IPV6_HDR_LEN + UDP_HDR_LEN); memset(buf, 0, len); - memcpy(buf, payload, udp_header->length - UDP_HDR_LEN); + memcpy(buf, payload, NTOHS(udp_header->length) - UDP_HDR_LEN); memcpy(&from->sin6_addr, &ipv6_header->srcaddr, 16); from->sin6_family = AF_INET6; from->sin6_flowinfo = 0; - from->sin6_port = udp_header->src_port; + from->sin6_port = NTOHS(udp_header->src_port); *fromlen = sizeof(sockaddr6_t); msg_reply(&m_recv, &m_send); - return udp_header->length - UDP_HDR_LEN; + return NTOHS(udp_header->length) - UDP_HDR_LEN; } #ifdef DESTINY_WITH_TCP else if (is_tcp_socket(s)) { @@ -1051,7 +1051,7 @@ int32_t destiny_socket_sendto(int s, const void *buf, uint32_t len, int flags, ipv6_sendto(&to->sin6_addr, IPPROTO_UDP, (uint8_t *)(current_udp_packet), NTOHS(current_udp_packet->length)); - return current_udp_packet->length; + return NTOHS(current_udp_packet->length); } else { return -1; diff --git a/sys/net/destiny/tcp_timer.c b/sys/net/destiny/tcp_timer.c index 3ee422f416..2504193a09 100644 --- a/sys/net/destiny/tcp_timer.c +++ b/sys/net/destiny/tcp_timer.c @@ -32,6 +32,7 @@ #include "tcp_timer.h" +char tcp_timer_stack[TCP_TIMER_STACKSIZE]; void handle_synchro_timeout(socket_internal_t *current_socket) { @@ -154,6 +155,7 @@ void tcp_general_timer(void) while (1) { inc_global_variables(); check_sockets(); + vtimer_remove(&tcp_vtimer); vtimer_set_wakeup(&tcp_vtimer, interval, thread_getpid()); thread_sleep(); } diff --git a/sys/net/destiny/tcp_timer.h b/sys/net/destiny/tcp_timer.h index 7c7b986695..2c0bdcdcf1 100644 --- a/sys/net/destiny/tcp_timer.h +++ b/sys/net/destiny/tcp_timer.h @@ -28,6 +28,4 @@ void tcp_general_timer(void); -char tcp_timer_stack[TCP_TIMER_STACKSIZE]; - #endif /* TCP_TIMER_H_ */ diff --git a/sys/net/destiny/udp.h b/sys/net/destiny/udp.h index dfee1fad9e..e707b76534 100644 --- a/sys/net/destiny/udp.h +++ b/sys/net/destiny/udp.h @@ -21,7 +21,7 @@ #include "ipv6.h" #include "destiny/types.h" -#define UDP_STACK_SIZE KERNEL_CONF_STACKSIZE_DEFAULT +#define UDP_STACK_SIZE KERNEL_CONF_STACKSIZE_MAIN uint16_t udp_csum(ipv6_hdr_t *ipv6_header, udp_hdr_t *udp_header); void udp_packet_handler(void); diff --git a/sys/net/sixlowpan/flowcontrol.c b/sys/net/sixlowpan/flowcontrol.c index e20e1ae720..184a3cd298 100644 --- a/sys/net/sixlowpan/flowcontrol.c +++ b/sys/net/sixlowpan/flowcontrol.c @@ -118,6 +118,7 @@ static int set_timeout(vtimer_t *timeout, long useconds, void *args) interval.seconds = useconds / 1000000; interval.microseconds = (useconds % 1000000) * 1000; + vtimer_remove(timeout); return vtimer_set_msg(timeout, interval, sending_slot_pid, args); }