Changeset 270 for trunk/src/sh_socket.c
- Timestamp:
- Jan 8, 2010, 6:32:36 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_socket.c
r265 r270 23 23 * #define SH_DEBUG_SOCKET 24 24 */ 25 25 26 #if defined(SH_WITH_SERVER) && defined(__linux__) 26 27 #define _GNU_SOURCE … … 180 181 if (0 == sl_strcmp(new->clt, clt)) 181 182 { 183 #ifdef SH_DEBUG_SOCKET 184 fprintf(stderr, "add2reload: time reset for %s\n", clt); 185 #endif 182 186 sl_strlcpy (new->clt, clt, SH_MAXMSGLEN); 183 187 new->cti = time(NULL); … … 188 192 189 193 new = SH_ALLOC(sizeof(struct reload_cmd)); 194 #ifdef SH_DEBUG_SOCKET 195 fprintf(stderr, "add2reload: time set for %s\n", clt); 196 #endif 190 197 sl_strlcpy (new->clt, clt, SH_MAXMSGLEN); 191 198 new->cti = time(NULL); … … 202 209 static void sh_socket_add2list (struct socket_cmd * in); 203 210 204 staticvoid sh_socket_probe4reload (void)211 void sh_socket_probe4reload (void) 205 212 { 206 213 struct reload_cmd * new; … … 215 222 struct stat buf; 216 223 224 #ifdef SH_DEBUG_SOCKET 225 fprintf(stderr, "PROBE\n"); 226 #endif 227 217 228 for (item = (client_t *) zAVLFirst(&avlcursor, all_clients); item; 218 229 item = (client_t *) zAVLNext(&avlcursor)) 219 230 { 231 #ifdef SH_DEBUG_SOCKET 232 fprintf(stderr, "%s %d\n", item->hostname, (int)item->status_now); 233 #endif 234 220 235 if (item->status_now != CLT_INACTIVE) 221 236 { 222 237 file = get_client_conf_file (item->hostname, &dummy); 223 238 239 #ifdef SH_DEBUG_SOCKET 240 fprintf(stderr, "%s\n", file); 241 #endif 224 242 if (0 == stat (file, &buf)) 225 243 { … … 227 245 while (new) 228 246 { 247 #ifdef SH_DEBUG_SOCKET 248 fprintf(stderr, "%s <> %s\n", new->clt, item->hostname); 249 #endif 229 250 if (0 == sl_strcmp(new->clt, item->hostname)) 230 251 { 252 #ifdef SH_DEBUG_SOCKET 253 fprintf(stderr, "%lu <> %lu\n", 254 (unsigned long) buf.st_mtime, 255 (unsigned long)new->cti); 256 #endif 231 257 if (buf.st_mtime > new->cti) 232 258 { … … 819 845 if (sl_strlen(cmd) >= SH_MAXMSGLEN) 820 846 { 847 #ifdef SH_DEBUG_SOCKET 848 fprintf (stderr, "Server: command too long: %s\n", cmd); 849 #endif 821 850 sh_error_handle((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN, 822 851 _("Bad message format: command too long"), … … 827 856 else if (sl_strlen(clt) >= SH_MAXMSGLEN) 828 857 { 858 #ifdef SH_DEBUG_SOCKET 859 fprintf (stderr, "Server: hostname too long: %s\n", clt); 860 #endif 829 861 sh_error_handle((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN, 830 862 _("Bad message format: hostname too long"), … … 836 868 cmd[2] == 'S' && cmd[3] == 'T') 837 869 { 870 #ifdef SH_DEBUG_SOCKET 871 fprintf (stderr, "Server: list %s\n", clt); 872 #endif 838 873 goto list_all; 839 874 } … … 841 876 cmd[2] == 'O' && cmd[3] == 'B' && cmd[4] == 'E') 842 877 { 878 #ifdef SH_DEBUG_SOCKET 879 fprintf (stderr, "Server: probe start %s\n", clt); 880 #endif 843 881 sh_socket_probe4reload(); 882 #ifdef SH_DEBUG_SOCKET 883 fprintf (stderr, "Server: probe done %s\n", clt); 884 #endif 844 885 cmd[0] = 'L'; cmd[1] = 'I'; cmd[2] = 'S'; cmd[3] = 'T';cmd[4] = '\0'; 845 886 goto list_all; … … 851 892 else 852 893 { 894 #ifdef SH_DEBUG_SOCKET 895 fprintf (stderr, "Server: bad message\n"); 896 #endif 853 897 sh_error_handle((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN, 854 898 _("Bad message format"), … … 965 1009 sl_strlcpy (new->cmd, in->cmd, sizeof(new->cmd)); 966 1010 sl_strlcpy (new->clt, in->clt, sizeof(new->clt)); 1011 #ifdef SH_DEBUG_SOCKET 1012 fprintf(stderr, "add2list: time set for %s\n", new->clt); 1013 #endif 967 1014 (void) sh_unix_time(0, new->cti, sizeof(new->cti)); 968 1015 new->next = cmdlist; … … 983 1030 sl_strlcpy (new->cmd, in->cmd, sizeof(new->cmd)); 984 1031 sl_strlcpy (new->clt, in->clt, sizeof(new->clt)); 1032 #ifdef SH_DEBUG_SOCKET 1033 fprintf(stderr, "add2run: time reset for %s\n", new->clt); 1034 #endif 985 1035 (void) sh_unix_time(0, new->cti, sizeof(new->cti)); 986 1036 return; … … 992 1042 sl_strlcpy (new->cmd, in->cmd, sizeof(new->cmd)); 993 1043 sl_strlcpy (new->clt, in->clt, sizeof(new->clt)); 1044 #ifdef SH_DEBUG_SOCKET 1045 fprintf(stderr, "add2run: time set for %s\n", new->clt); 1046 #endif 994 1047 (void) sh_unix_time(0, new->cti, sizeof(new->cti)); 995 1048 new->next = runlist;
Note:
See TracChangeset
for help on using the changeset viewer.