Changeset db654df


Ignore:
Timestamp:
Mar 29, 2009, 9:34:47 PM (15 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
owl
Children:
f19fef4
Parents:
6d7e6c6
Message:
remove the excessive process_events (it oddly made the situation
   worse) and instead call it just on sending login and logout
   notificatinos.
new debug message in loadsubs
new handle_ack
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    r64b6449 rdb654df  
    427427  nexttime=time(NULL);
    428428
    429   owl_zephyr_process_events(NULL);
     429  /* owl_zephyr_process_events(NULL); */
    430430  owl_function_debugmsg("startup: entering main loop");
    431431  /* main loop */
     
    622622     * own select loop and may leave zephyrs on the queue. Check for
    623623     * them now, and process any we find. */
    624     owl_zephyr_process_events(NULL);
     624    /* owl_zephyr_process_events(NULL); */
    625625    owl_select();
    626     owl_zephyr_process_events(NULL);
     626    /* owl_zephyr_process_events(NULL); */
    627627   
    628628    /* Log any error signals */
  • select.c

    rb310c0e rdb654df  
    7575
    7676  if (elt != -1) {  /* If we have a dispatch for this FD */
     77    owl_function_debugmsg("select: duplicate dispatch found");
    7778    owl_dispatch *d_old;
    7879    d_old = (owl_dispatch*)owl_list_get_element(dl, elt);
     
    210211
    211212  /* owl_select_process_timers(&timeout); */
    212   timeout.tv_sec = 60;
     213
     214  /* settings to 5 seconds for the moment, we can raise this when the
     215   * odd select behavior with zephyr is understood
     216   */
     217  timeout.tv_sec = 5;
    213218  timeout.tv_usec = 0;
    214219
  • zephyr.c

    r6d7e6c6 rdb654df  
    2626    return(1);
    2727  }
    28   owl_zephyr_process_events(NULL);
    2928#endif
    3029  return(0);
     
    3635#ifdef HAVE_LIBZEPHYR
    3736  unsuball();
    38   owl_zephyr_process_events(NULL);
    3937  ZClosePort();
    4038#endif
     
    8583    owl_free(subs[i].zsub_recipient);
    8684  }
    87   owl_zephyr_process_events(NULL);
    8885  return ret;
    8986}
     
    116113  ret=stat(subsfile, &statbuff);
    117114  if (ret) {
     115    owl_function_debugmsg("loadsubs: could not stat file %s", subsfile)
    118116    if (error_on_nofile==1) return(-1);
    119117    return(0);
     
    123121  count=0;
    124122  file=fopen(subsfile, "r");
    125   if (!file) return(-1);
     123  if (!file) {
     124    owl_function_debugmsg("loadsubs: could not open file %s", subsfile)
     125    return(-1);
     126  }
    126127  while ( fgets(buffer, 1024, file)!=NULL ) {
    127128    if (buffer[0]=='#' || buffer[0]=='\n' || buffer[0]=='\n') continue;
     
    176177    return(-1);
    177178  }
    178   owl_zephyr_process_events(NULL);
    179179  return(0);
    180180#else
     
    241241  }
    242242
    243   owl_zephyr_process_events(NULL);
    244 
    245243  return(ret);
    246244#else
     
    276274    return(-2);
    277275  }
    278   owl_zephyr_process_events(NULL);
    279276  return(0);
    280277#else
     
    298295    return(-2);
    299296  }
    300   owl_zephyr_process_events(NULL);
    301297  return(0);
    302298#else
     
    468464  owl_free(notice.z_message);
    469465  ZFreeNotice(&notice);
    470   owl_zephyr_process_events(NULL);
    471466  if (ret!=ZERR_NONE) {
    472467    owl_function_error("Error sending zephyr");
     
    484479  int ret;
    485480  ret=ZSendPacket(buf, len, 0);
    486   owl_zephyr_process_events(NULL);
    487481  return(ret);
    488482}
     
    493487#ifdef HAVE_LIBZEPHYR
    494488  send_zephyr("PING", "", "MESSAGE", "PERSONAL", to, "");
    495   owl_zephyr_process_events(NULL);
    496489#endif
    497490}
     
    500493void owl_zephyr_handle_ack(ZNotice_t *retnotice)
    501494{
    502   char *tmp, *buff;
     495  char *tmp;
    503496 
    504497  /* if it's an HMACK ignore it */
     
    521514    }
    522515  } else if (!strcmp(retnotice->z_message, ZSRVACK_NOTSENT)) {
    523     if (strcasecmp(retnotice->z_class, "message")) {
    524       owl_function_error("No one subscribed to class class %s", retnotice->z_class);
    525       buff=owl_sprintf("Could not send message to class %s: no one subscribed.\n",
    526                        retnotice->z_class);
     516    #define BUFFLEN 1024
     517    if (retnotice->z_recipient == NULL
     518        || *retnotice->z_recipient == 0
     519        || *retnotice->z_recipient == '@') {
     520      char buff[BUFFLEN];
     521      owl_function_error("No one subscribed to class %s", retnotice->z_class);
     522      snprintf(buff, BUFFLEN, "Could not send message to class %s: no one subscribed.\n", retnotice->z_class);
    527523      owl_function_adminmsg("", buff);
    528       owl_free(buff);
    529524    } else {
     525      char buff[BUFFLEN];
    530526      tmp = short_zuser(retnotice->z_recipient);
    531       owl_function_error("%s: Not logged in or subscribing to messages.", tmp);
    532       buff=owl_sprintf("Could not send message to %s: not logged in or subscribing to messages.\n",
    533                        tmp);
     527      owl_function_error("%s: Not logged in or subscribing.", tmp);
     528      if(strcmp(retnotice->z_class, "message")) {
     529        snprintf(buff, BUFFLEN,
     530                 "Could not send message to %s: "
     531                 "not logged in or subscribing to class %s, instance %s.\n",
     532                 tmp,
     533                 retnotice->z_class,
     534                 retnotice->z_class_inst);
     535      } else {
     536        snprintf(buff, BUFFLEN,
     537                 "Could not send message to %s: "
     538                 "not logged in or subscribing to messages.\n",
     539                 tmp);
     540      }
    534541      owl_function_adminmsg("", buff);
    535542      owl_log_outgoing_zephyr_error(tmp, buff);
    536543      owl_free(tmp);
    537       owl_free(buff);
    538544    }
    539545  } else {
    540546    owl_function_error("Internal error on ack (%s)", retnotice->z_message);
    541547  }
    542   owl_zephyr_process_events(NULL);
    543548}
    544549#else
     
    635640  ZResetAuthentication();
    636641  ret=ZLocateUser(user,&numlocs,auth?ZAUTH:ZNOAUTH);
    637   owl_zephyr_process_events(NULL);
    638642  if (ret != ZERR_NONE) {
    639643    return(owl_sprintf("Error locating user %s\n", user));
     
    661665    owl_free(myuser);
    662666  }
    663   owl_zephyr_process_events(NULL);
    664667  return(out);
    665668#else
     
    866869      int tmpbufflen;
    867870      char *tmpbuff;
    868       owl_zephyr_process_events(NULL);
    869871      tmpbuff = owl_sprintf("<%s,%s,%s>\n%s", sub.zsub_class, sub.zsub_classinst, sub.zsub_recipient, out);
    870872      tmpbufflen = strlen(tmpbuff) + 1;
     
    888890
    889891  ZFlushSubscriptions();
    890   owl_zephyr_process_events(NULL);
    891892  return(out);
    892893#else
     
    908909#ifdef HAVE_LIBZEPHYR
    909910  ZInitLocationInfo(host, val);
    910   owl_zephyr_process_events(NULL);
    911911#endif
    912912}
Note: See TracChangeset for help on using the changeset viewer.