aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_wlan.c
diff options
context:
space:
mode:
authorDavid Brodski <david@brodski.eu>2011-02-08 09:34:41 +0000
committerDavid Brodski <david@brodski.eu>2011-02-08 09:34:41 +0000
commitdd74b7a28b31929afcf91ac92d21d22db938af93 (patch)
tree3e5661956a937622a7933678857a872344727d1b /src/transport/plugin_transport_wlan.c
parent1a11ec73bfe097463b60b41ceed503e3d2924a44 (diff)
downloadgnunet-dd74b7a28b31929afcf91ac92d21d22db938af93.tar.gz
gnunet-dd74b7a28b31929afcf91ac92d21d22db938af93.zip
Memory and assertion errors fixed
Diffstat (limited to 'src/transport/plugin_transport_wlan.c')
-rw-r--r--src/transport/plugin_transport_wlan.c40
1 files changed, 10 insertions, 30 deletions
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 02e6964d9..050286881 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -696,7 +696,7 @@ queue_Session (struct Plugin *plugin,
696 696
697 while (queue != NULL){ 697 while (queue != NULL){
698 // content is never NULL 698 // content is never NULL
699 GNUNET_assert (queue->content == NULL); 699 GNUNET_assert (queue->content != NULL);
700 // is session already in queue? 700 // is session already in queue?
701 if (session == queue->content){ 701 if (session == queue->content){
702 return; 702 return;
@@ -819,6 +819,7 @@ check_next_fragment_timeout(struct Plugin * const plugin)
819 if (plugin->server_write_delay_task != GNUNET_SCHEDULER_NO_TASK) 819 if (plugin->server_write_delay_task != GNUNET_SCHEDULER_NO_TASK)
820 { 820 {
821 GNUNET_SCHEDULER_cancel(plugin->server_write_delay_task); 821 GNUNET_SCHEDULER_cancel(plugin->server_write_delay_task);
822 plugin->server_write_delay_task = GNUNET_SCHEDULER_NO_TASK;
822 } 823 }
823 fm = plugin->pending_Fragment_Messages_head; 824 fm = plugin->pending_Fragment_Messages_head;
824 825
@@ -1050,11 +1051,12 @@ do_transmit(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1050 uint copyoffset = 0; 1051 uint copyoffset = 0;
1051 struct AckQueue * akt = NULL; 1052 struct AckQueue * akt = NULL;
1052 1053
1053#if 1 1054
1054 struct GNUNET_MessageHeader * msgheader2 = NULL; 1055 struct GNUNET_MessageHeader * msgheader2 = NULL;
1055 1056
1056 //test if a "hello-beacon" has to be send 1057 //test if a "hello-beacon" has to be send
1057 if (GNUNET_TIME_absolute_get_remaining(plugin->beacon_time).rel_value == 0) 1058 if (0==1)
1059 //if (GNUNET_TIME_absolute_get_remaining(plugin->beacon_time).rel_value == 0)
1058 { 1060 {
1059 //check if the message is not to big 1061 //check if the message is not to big
1060 GNUNET_assert(sizeof(struct WlanHeader) + GNUNET_HELLO_size( 1062 GNUNET_assert(sizeof(struct WlanHeader) + GNUNET_HELLO_size(
@@ -1103,7 +1105,7 @@ do_transmit(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1103 1105
1104 } 1106 }
1105 1107
1106#endif 1108
1107 1109
1108 fm = plugin->pending_Fragment_Messages_head; 1110 fm = plugin->pending_Fragment_Messages_head;
1109 GNUNET_assert(fm != NULL); 1111 GNUNET_assert(fm != NULL);
@@ -1642,7 +1644,7 @@ wlan_plugin_address_to_string (void *cls,
1642 const void *addr, 1644 const void *addr,
1643 size_t addrlen) 1645 size_t addrlen)
1644{ 1646{
1645 char ret[92]; 1647 static char ret[40];
1646 const unsigned char * input; 1648 const unsigned char * input;
1647 1649
1648 GNUNET_assert(cls !=NULL); 1650 GNUNET_assert(cls !=NULL);
@@ -1658,7 +1660,7 @@ wlan_plugin_address_to_string (void *cls,
1658 "%s Mac-Adress %X:%X:%X:%X:%X:%X", 1660 "%s Mac-Adress %X:%X:%X:%X:%X:%X",
1659 PROTOCOL_PREFIX, 1661 PROTOCOL_PREFIX,
1660 input[0], input[1], input[2], input[3], input[4], input[5]); 1662 input[0], input[1], input[2], input[3], input[4], input[5]);
1661 return GNUNET_strdup (ret); 1663 return ret;
1662} 1664}
1663 1665
1664/** 1666/**
@@ -1876,11 +1878,6 @@ wlan_data_helper(void *cls, void * client, const struct GNUNET_MessageHeader * h
1876 return; 1878 return;
1877 } 1879 }
1878 1880
1879#if DEBUG_wlan
1880 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1881 "After crc\n");
1882#endif
1883
1884 //if not in session list 1881 //if not in session list
1885 if (session == NULL) 1882 if (session == NULL)
1886 { 1883 {
@@ -1888,10 +1885,6 @@ wlan_data_helper(void *cls, void * client, const struct GNUNET_MessageHeader * h
1888 //try if it is a hello message 1885 //try if it is a hello message
1889 if (ntohs(temp_hdr->type) == GNUNET_MESSAGE_TYPE_HELLO) 1886 if (ntohs(temp_hdr->type) == GNUNET_MESSAGE_TYPE_HELLO)
1890 { 1887 {
1891#if DEBUG_wlan
1892 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1893 "New WLAN Client\n");
1894#endif
1895 session = create_session(plugin, session_light->addr); 1888 session = create_session(plugin, session_light->addr);
1896 session_light->session = session; 1889 session_light->session = session;
1897 GNUNET_assert(GNUNET_HELLO_get_id( 1890 GNUNET_assert(GNUNET_HELLO_get_id(
@@ -1907,28 +1900,15 @@ wlan_data_helper(void *cls, void * client, const struct GNUNET_MessageHeader * h
1907 } 1900 }
1908 } 1901 }
1909 1902
1910#if DEBUG_wlan
1911 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1912 "After session\n");
1913#endif
1914
1915 //"receive" the message 1903 //"receive" the message
1916 struct GNUNET_TRANSPORT_ATS_Information distance[2]; 1904 struct GNUNET_TRANSPORT_ATS_Information distance[2];
1917 distance[0].type = htonl(GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE); 1905 distance[0].type = htonl(GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
1918 distance[0].value = htonl(1); 1906 distance[0].value = htonl(1);
1919 distance[1].type = htonl(GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); 1907 distance[1].type = htonl(GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
1920 distance[1].value = htonl(0); 1908 distance[1].value = htonl(0);
1921#if DEBUG_wlan 1909 plugin->env->receive(plugin->env->cls, &(session->target), temp_hdr,
1922 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1923 "After Information\n");
1924#endif
1925 plugin->env->receive(plugin->env, &(session->target), temp_hdr,
1926 (const struct GNUNET_TRANSPORT_ATS_Information *) &distance, 2, 1910 (const struct GNUNET_TRANSPORT_ATS_Information *) &distance, 2,
1927 session, session->addr, sizeof(session->addr)); 1911 session, session->addr, sizeof(session->addr));
1928#if DEBUG_wlan
1929 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1930 "After receive\n");
1931#endif
1932 1912
1933 } 1913 }
1934 1914
@@ -2081,7 +2061,7 @@ wlan_data_helper(void *cls, void * client, const struct GNUNET_MessageHeader * h
2081 return; 2061 return;
2082 } 2062 }
2083 2063
2084#if DEBUG_wlan 2064#if 0
2085 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 2065 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2086 "Helper finished\n"); 2066 "Helper finished\n");
2087#endif 2067#endif