uip_udp_periodic_conn(data); if(uip_len > 0) { tcpip_output();
if(data != NULL) { uip_udp_periodic_conn(data); if(uip_len > 0) { tcpip_output(); }
EK_EVENTHANDLER(eventhandler, ev, data){  static unsigned char i;  register struct listenport *l;  ek_id_t id;  struct internal_state *state;    switch(ev) {  case EK_EVENT_INIT:           for(i = 0; i < UIP_LISTENPORTS; ++i) {      s.listenports[i].port = 0;    }    s.id = EK_PROC_ID(EK_CURRENT());    tcpip_event = s.event = ek_alloc_event();    timer_set(&periodic, CLOCK_SECOND/2);      break;  case EK_EVENT_REPLACE:    memcpy(&s, data, sizeof(s));    arg_free(data);    break;  case EK_EVENT_REQUEST_REPLACE:    state = (struct internal_state *)arg_alloc(sizeof(s));    /* Copy state */    memcpy(state, &s, sizeof(s));     ek_replace((struct ek_proc *)data, state);    break;      case EK_EVENT_EXITED:    id = (ek_id_t)data;    l = s.listenports;    for(i = 0; i < UIP_LISTENPORTS; ++i) {      if(l->id == id) {	uip_unlisten(l->port);	l->port = 0;	l->id = EK_ID_NONE;      }      ++l;    }    /*    for(i = 0; i < UIP_CONNS; ++i) {      if(((struct tcpip_uipstate *)uip_conns[i].appstate)->id == id) {      ((struct tcpip_uipstate *)uip_conns[i].appstate)->id = EK_ID_NONE;	uip_conns[i].tcpstateflags = CLOSED;      }      }*/    {      register struct uip_conn *cptr;           for(cptr = &uip_conns[0]; cptr < &uip_conns[UIP_CONNS]; ++cptr) {	if(((struct tcpip_uipstate *)cptr->appstate)->id == id) {	  ((struct tcpip_uipstate *)cptr->appstate)->id = EK_ID_NONE;	  cptr->tcpstateflags = CLOSED;	}            }          }#if UIP_UDP    {      register struct uip_udp_conn *cptr;      for(cptr = &uip_udp_conns[0];	  cptr < &uip_udp_conns[UIP_UDP_CONNS]; ++cptr) {	if(((struct tcpip_uipstate *)cptr->appstate)->id == id) {	  cptr->lport = 0;	}      }          }    /*    for(i = 0; i < UIP_UDP_CONNS; ++i) {      if(((struct tcpip_uipstate *)uip_udp_conns[i].appstate)->id == id) {	uip_udp_conns[i].lport = 0;      }      }*/#endif /* UIP_UDP */    break;  case TCP_POLL:    uip_periodic_conn(data);    if(uip_len > 0) {      tcpip_output();    }    break;  case UDP_POLL:    uip_udp_periodic_conn(data);    if(uip_len > 0) {      tcpip_output();    }    break;  };}