Hi Carsten,

In the CoAP-HTTP proxy model, there is a common situation that too
many requests from HTTP enabled web may overwhelm some constrained
node. So we believe the coap-http proxy should do something to manage
the load from the web to the constrained network.

In order to achieve this goal, the proxy creats a thread for each of
the request from the web, and initiates a semaphore for the
interactive control. If the number of requests exceeds a certain
threshold, the proxy will deny the request or set up a timeout-able
waiting scheme for the request.

The pseudo code is as below, and we would like to test this in our lab
environment.

1)simply reply with "service unavailable" if currently no resource can
respond.
Http_CoAp_thread(char* pnodename,...)
{
   rethandle=createevent(pnodename);// creat the semaphore
   if(ERROR_ALREADY_EXISTS == rethandle)// if it is busy
       {//reply with "Service Unavailable"
           sethttpstate(httpbuf,503,"Service Unavailable");
           sendhttp(socket, httpbuf);
           releaseresource();
           return;
       }
   else
       {
           ……//handle the coap request
           setevent(rethandle);// release
       }
       return;
}

2)waiting mode
Http_CoAp_thread(char* pnodename,...)
{
   rethandle=createevent(pnodename);// create the semaphore
   if(ERROR_ALREADY_EXISTS == rethandle)// if alreay exist
       {
           // wait per policy
           retdw=waitforsignleobject(rethandle,xxx);
           if(retdw==EVENT_OK)// get the access permit
               {
                   goto eventok;
               }
           else// timeout
               {//Reply with "Service Unavailable"
                   sethttpstate(httpbuf,503,"Service Unavailable");
                   sendhttp(socket, httpbuf);
                   releaseresource();
                   return;
               }
       }

eventok:
        ……//handle the coap request
       setevent(rethandle);// release
       return;
}
By the way, would that be possible to add those information to the basic
guidance document? thanks

Best regards,

-Hui
_______________________________________________
Lwip mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/lwip

Reply via email to