Changes in uspace/srv/net/tcp/tcp.c [06a1d077:02a09ed] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/tcp.c
r06a1d077 r02a09ed 69 69 size_t pdu_raw_size; 70 70 71 log_msg(L VL_DEBUG, "tcp_inet_ev_recv()");71 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_inet_ev_recv()"); 72 72 73 73 pdu_raw = dgram->data; … … 76 76 /* Split into header and payload. */ 77 77 78 log_msg(L VL_DEBUG, "tcp_inet_ev_recv() - split header/payload");78 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_inet_ev_recv() - split header/payload"); 79 79 80 80 tcp_pdu_t *pdu; … … 84 84 85 85 if (pdu_raw_size < sizeof(tcp_header_t)) { 86 log_msg(L VL_WARN, "pdu_raw_size = %zu < sizeof(tcp_header_t) = %zu",86 log_msg(LOG_DEFAULT, LVL_WARN, "pdu_raw_size = %zu < sizeof(tcp_header_t) = %zu", 87 87 pdu_raw_size, sizeof(tcp_header_t)); 88 88 return EINVAL; … … 96 96 97 97 if (pdu_raw_size < hdr_size) { 98 log_msg(L VL_WARN, "pdu_raw_size = %zu < hdr_size = %zu",98 log_msg(LOG_DEFAULT, LVL_WARN, "pdu_raw_size = %zu < hdr_size = %zu", 99 99 pdu_raw_size, hdr_size); 100 100 return EINVAL; … … 102 102 103 103 if (hdr_size < sizeof(tcp_header_t)) { 104 log_msg(L VL_WARN, "hdr_size = %zu < sizeof(tcp_header_t) = %zu",104 log_msg(LOG_DEFAULT, LVL_WARN, "hdr_size = %zu < sizeof(tcp_header_t) = %zu", 105 105 hdr_size, sizeof(tcp_header_t)); return EINVAL; 106 106 } 107 107 108 log_msg(L VL_DEBUG, "pdu_raw_size=%zu, hdr_size=%zu",108 log_msg(LOG_DEFAULT, LVL_DEBUG, "pdu_raw_size=%zu, hdr_size=%zu", 109 109 pdu_raw_size, hdr_size); 110 110 pdu = tcp_pdu_create(pdu_raw, hdr_size, pdu_raw + hdr_size, 111 111 pdu_raw_size - hdr_size); 112 112 if (pdu == NULL) { 113 log_msg(L VL_WARN, "Failed creating PDU. Dropped.");113 log_msg(LOG_DEFAULT, LVL_WARN, "Failed creating PDU. Dropped."); 114 114 return ENOMEM; 115 115 } 116 116 117 pdu->src_addr.ipv4 = dgram->src.ipv4; 118 pdu->dest_addr.ipv4 = dgram->dest.ipv4; 119 log_msg(LVL_DEBUG, "src: 0x%08x, dest: 0x%08x", 120 pdu->src_addr.ipv4, pdu->dest_addr.ipv4); 117 pdu->src = dgram->src; 118 pdu->dest = dgram->dest; 121 119 122 120 tcp_received_pdu(pdu); … … 137 135 pdu_raw = malloc(pdu_raw_size); 138 136 if (pdu_raw == NULL) { 139 log_msg(L VL_ERROR, "Failed to transmit PDU. Out of memory.");137 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to transmit PDU. Out of memory."); 140 138 return; 141 139 } … … 145 143 pdu->text_size); 146 144 147 dgram.src .ipv4 = pdu->src_addr.ipv4;148 dgram.dest .ipv4 = pdu->dest_addr.ipv4;145 dgram.src = pdu->src; 146 dgram.dest = pdu->dest; 149 147 dgram.tos = 0; 150 148 dgram.data = pdu_raw; … … 153 151 rc = inet_send(&dgram, INET_TTL_MAX, 0); 154 152 if (rc != EOK) 155 log_msg(L VL_ERROR, "Failed to transmit PDU.");153 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to transmit PDU."); 156 154 } 157 155 … … 162 160 tcp_sockpair_t rident; 163 161 164 log_msg(L VL_DEBUG, "tcp_received_pdu()");162 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_received_pdu()"); 165 163 166 164 if (tcp_pdu_decode(pdu, &rident, &dseg) != EOK) { 167 log_msg(L VL_WARN, "Not enough memory. PDU dropped.");165 log_msg(LOG_DEFAULT, LVL_WARN, "Not enough memory. PDU dropped."); 168 166 return; 169 167 } … … 177 175 int rc; 178 176 179 log_msg(L VL_DEBUG, "tcp_init()");177 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_init()"); 180 178 181 179 tcp_rqueue_init(); 182 tcp_rqueue_ thread_start();180 tcp_rqueue_fibril_start(); 183 181 184 182 tcp_ncsim_init(); 185 tcp_ncsim_ thread_start();183 tcp_ncsim_fibril_start(); 186 184 187 185 if (0) tcp_test(); … … 189 187 rc = inet_init(IP_PROTO_TCP, &tcp_inet_ev_ops); 190 188 if (rc != EOK) { 191 log_msg(L VL_ERROR, "Failed connecting to internet service.");189 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed connecting to internet service."); 192 190 return ENOENT; 193 191 } … … 195 193 rc = tcp_sock_init(); 196 194 if (rc != EOK) { 197 log_msg(L VL_ERROR, "Failed initializing socket service.");195 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed initializing socket service."); 198 196 return ENOENT; 199 197 } … … 208 206 printf(NAME ": TCP (Transmission Control Protocol) network module\n"); 209 207 210 rc = log_init(NAME , LVL_WARN);208 rc = log_init(NAME); 211 209 if (rc != EOK) { 212 210 printf(NAME ": Failed to initialize log.\n");
Note:
See TracChangeset
for help on using the changeset viewer.