Changeset 15654


Ignore:
Timestamp:
05/10/12 22:21:25 (12 years ago)
Author:
nit
Message:

[titan] check pictimeout before add new pic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/pic.h

    r15501 r15654  
    1313}
    1414
     15void checkpictimeout()
     16{
     17  struct pic* node = pic;
     18  time_t akttime = time(NULL);
     19
     20  while(node != NULL)
     21  {
     22    if(node->timeout != 0 && node->lastaccess + node->timeout < akttime)
     23      delpic(node->name);
     24    node = node->next;
     25  }
     26}
     27
    1528struct pic* addpic(char *name, unsigned char* picbuf, int memfd, unsigned long width, unsigned long height, unsigned long rowbytes, int channels, int timeout, int del, struct pic* last)
    1629{
    1730        debug(1000, "in");
     31
     32        //chech if pic timed aut and can remove
     33        checkpictimeout();
     34
    1835        struct pic *newnode = NULL, *prev = NULL, *node = pic;
    1936
     
    136153}
    137154
    138 void checkpictimeout()
    139 {
    140   struct pic* node = pic;
    141   time_t akttime = time(NULL);
    142 
    143   while(node != NULL)
    144   {
    145     if(node->timeout != 0 && node->lastaccess + node->timeout < akttime)
    146       delpic(node->name);
    147     node = node->next;
    148   }
    149 }
    150 
    151155struct pic* getpic(char* name)
    152156{
Note: See TracChangeset for help on using the changeset viewer.