Ignore:
Timestamp:
Jan 8, 2016, 2:35:52 PM (8 years ago)
Author:
coas-nagasima
Message:

メッセージバッファ領域がなくなったときにWebSocketパケットを誤って処理してしまうのを修正。
Ethernet送信バッファが取れないときにパケットが送信できなかったのを修正。
その他、処理の安定性の向上。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uKadecot/trunk/uip/task/uip_task.c

    r125 r148  
    9898        T_IF_SOFTC      *ic = IF_ETHER_NIC_GET_SOFTC();
    9999        int ret;
     100        bool_t tx;
    100101
    101102        PT_BEGIN(&uiptsk->pt);
     
    124125
    125126                PT_WAIT_UNTIL(&uiptsk->pt, (ret = ic->link_pre != ic->link_now ? 1 :
    126                         (ic->rxb_read != ic->rxb_write ? 2 :
    127127                        (uip_out_buf[uip_out_rpos].len > 0 ? 3 :
    128128                        (ws_out_req != ws_out_res ? 4 :
    129                         (timer_expired(&uiptsk->periodic_timer) ? 5 : 0))))) != 0);
     129                        (timer_expired(&uiptsk->periodic_timer) ? 5 :
     130                        (ic->rxb_read != ic->rxb_write ? 2 : 0))))) != 0);
    130131
    131132                if(ret == 1){
     
    146147                                                if (uip_len > 0) {
    147148                                                        uip_arp_out();
    148                                                         IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     149                                                        for (;;) {
     150                                                                tx = IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     151                                                                if (tx)
     152                                                                        break;
     153                                                                PT_YIELD(&uiptsk->pt);
     154                                                        }
    149155                                                }
    150156                                        }
     
    174180                                        if (uip_len > 0) {
    175181                                                uip_arp_out();
    176                                                 IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     182                                                for (;;) {
     183                                                        tx = IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     184                                                        if (tx)
     185                                                                break;
     186                                                        PT_YIELD(&uiptsk->pt);
     187                                                }
    177188                                                PT_YIELD(&uiptsk->pt);
    178189                                                continue;
     
    185196                                           uip_len is set to a value > 0. */
    186197                                        if (uip_len > 0) {
    187                                                 IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     198                                                for (;;) {
     199                                                        tx = IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     200                                                        if (tx)
     201                                                                break;
     202                                                        PT_YIELD(&uiptsk->pt);
     203                                                }
    188204                                                PT_YIELD(&uiptsk->pt);
    189205                                                continue;
     
    204220                        uip_udp_send(buf->len);
    205221
    206                         buf->len = 0;
    207                         uip_out_rpos++;
    208                         if (uip_out_rpos >= UIP_BUF_COUNT)
    209                                 uip_out_rpos = 0;
    210 
    211222                        uip_udp_conn = cepid;
    212223                        uip_process(UIP_UDP_SEND_CONN);
     
    214225                        cepid->rport = 0;
    215226                        uip_arp_out();
    216                         IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     227                        for (;;) {
     228                                tx = IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     229                                if (tx)
     230                                        break;
     231                                PT_YIELD(&uiptsk->pt);
     232                        }
     233
     234                        buf = &uip_out_buf[uip_out_rpos];
     235                        uip_out_rpos++;
     236                        if (uip_out_rpos >= UIP_BUF_COUNT)
     237                                uip_out_rpos = 0;
     238                        buf->len = 0;
     239
    217240                        PT_YIELD(&uiptsk->pt);
    218241                        continue;
     
    231254                                if (uip_len > 0) {
    232255                                        uip_arp_out();
    233                                         IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     256                                        for (;;) {
     257                                                tx = IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     258                                                if (tx)
     259                                                        break;
     260                                                PT_YIELD(&uiptsk->pt);
     261                                        }
    234262                                        PT_YIELD(&uiptsk->pt);
    235263                                }
     
    247275                                if (uip_len > 0) {
    248276                                        uip_arp_out();
    249                                         IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     277                                        for (;;) {
     278                                                tx = IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     279                                                if (tx)
     280                                                        break;
     281                                                PT_YIELD(&uiptsk->pt);
     282                                        }
    250283                                        PT_YIELD(&uiptsk->pt);
    251284                                }
     
    261294                                if (uip_len > 0) {
    262295                                        uip_arp_out();
    263                                         IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     296                                        for (;;) {
     297                                                tx = IF_ETHER_NIC_START(ic, uip_buf, uip_len);
     298                                                if (tx)
     299                                                        break;
     300                                                PT_YIELD(&uiptsk->pt);
     301                                        }
    264302                                        PT_YIELD(&uiptsk->pt);
    265303                                }
Note: See TracChangeset for help on using the changeset viewer.