thermferm/server.c

changeset 280
de3dc781ba65
parent 279
4c505414435c
child 281
12a5dbbfd0e3
equal deleted inserted replaced
279:4c505414435c 280:de3dc781ba65
912 912
913 for (profile = Config.profiles; profile; profile = profile->next) { 913 for (profile = Config.profiles; profile; profile = profile->next) {
914 if (strcmp(profile->uuid, param) == 0) { 914 if (strcmp(profile->uuid, param) == 0) {
915 915
916 if (profile->steps) { 916 if (profile->steps) {
917 syslog(LOG_NOTICE, "PROFILE PUTS %s erased all old steps", profile->uuid);
917 for (step = profile->steps; step; step = olds) { 918 for (step = profile->steps; step; step = olds) {
918 olds = step->next; 919 olds = step->next;
919 free(step); 920 free(step);
920 } 921 }
921 profile->steps = NULL; 922 profile->steps = NULL;
922 } 923 }
923 924
925 j = 0;
924 while (1) { 926 while (1) {
925 memset((char *)&ibuf, 0, SS_BUFSIZE); 927 memset((char *)&ibuf, 0, SS_BUFSIZE);
926 fromlen = sizeof(peeraddr_in); 928 fromlen = sizeof(peeraddr_in);
927 rlen = recvfrom(s, ibuf, sizeof(ibuf) -1, 0, (struct sockaddr *)&peeraddr_in, &fromlen); 929 rlen = recvfrom(s, ibuf, sizeof(ibuf) -1, 0, (struct sockaddr *)&peeraddr_in, &fromlen);
928 if (rlen == -1) { 930 if (rlen == -1) {
958 960
959 if ((sscanf(sstep, "%d", &istep) == 1) && 961 if ((sscanf(sstep, "%d", &istep) == 1) &&
960 (sscanf(rest, "%d", &irest) == 1) && 962 (sscanf(rest, "%d", &irest) == 1) &&
961 (sscanf(targ, "%f", &ftarg) == 1)) { 963 (sscanf(targ, "%f", &ftarg) == 1)) {
962 964
965 j++;
966 syslog(LOG_NOTICE, "PROFILE PUTS %s add step %d: steptime=%d resttime=%d target=%.1f",
967 profile->uuid, j, istep, irest, ftarg);
963 step = (prof_step *)malloc(sizeof(prof_step)); 968 step = (prof_step *)malloc(sizeof(prof_step));
964 step->next = NULL; 969 step->next = NULL;
965 step->version = 1; 970 step->version = 1;
966 step->steptime = istep; 971 step->steptime = istep;
967 step->resttime = irest; 972 step->resttime = irest;

mercurial