[BACK]Return to sm1Socket.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / plugin

Diff for /OpenXM/src/kan96xx/plugin/sm1Socket.c between version 1.14 and 1.17

version 1.14, 2002/10/30 13:23:06 version 1.17, 2004/02/25 23:14:35
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/kan96xx/plugin/sm1Socket.c,v 1.13 2002/10/24 02:12:35 takayama Exp $ */  /* $OpenXM: OpenXM/src/kan96xx/plugin/sm1Socket.c,v 1.16 2004/02/23 09:03:43 takayama Exp $ */
 /* msg0s.c */  /* msg0s.c */
 #include <stdio.h>  #include <stdio.h>
 #include <sys/types.h>  #include <sys/types.h>
Line 6 
Line 6 
 #include <sys/time.h>  #include <sys/time.h>
 #include <netinet/in.h>  #include <netinet/in.h>
 #include <netdb.h>  #include <netdb.h>
   #include <errno.h>
   
   
 #include "datatype.h"  #include "datatype.h"
Line 30  struct object KsocketOpen(struct object obj) {
Line 31  struct object KsocketOpen(struct object obj) {
   int s_waiting;    int s_waiting;
   int on;    int on;
   int tt;    int tt;
   extern int errno;  
   extern int Post_debug;    extern int Post_debug;
   
   if ((char *)getenv("OXWEB_DEBUG") != NULL) {    if ((char *)getenv("OXWEB_DEBUG") != NULL) {
Line 179  struct object KsocketAccept(struct object obj) {
Line 179  struct object KsocketAccept(struct object obj) {
   }    }
   s = KopInteger(obj1);    s = KopInteger(obj1);
   if ((news = accept(s,NULL,NULL)) < 0) {    if ((news = accept(s,NULL,NULL)) < 0) {
     errorMsg1s("Error in accept.");      fprintf(stderr,"Error in accept. Retrying (KsocketAccept).\n");
       /* Code added for strange behavior on cygwin. */
       if ((news = accept(s,NULL,NULL)) < 0) {
         errorMsg1s("Error in accept. Retry failed.");
       }
   }    }
   if (close(s) < 0) {    if (close(s) < 0) {
     errorMsg1s("Error in closing the old socket.");      errorMsg1s("Error in closing the old socket.");
Line 215  struct object KsocketAccept2(struct object obj) {
Line 219  struct object KsocketAccept2(struct object obj) {
   }    }
   s = KopInteger(obj1);    s = KopInteger(obj1);
   if ((news = accept(s,NULL,NULL)) < 0) {    if ((news = accept(s,NULL,NULL)) < 0) {
     errorMsg1s("Error in accept.");      fprintf(stderr,"Error in accept. Retrying (KsocketAccept2).\n");
       /* Code added for strange behavior on cygwin. */
       if ((news = accept(s,NULL,NULL)) < 0) {
         errorMsg1s("Error in accept. Retry failed.");
       }
   }    }
   if (close(s) < 0) {    if (close(s) < 0) {
     errorMsg1s("Error in closing the old socket.");      errorMsg1s("Error in closing the old socket.");
Line 228  struct object KsocketAccept2(struct object obj) {
Line 236  struct object KsocketAccept2(struct object obj) {
 int KsocketSelect0(int fd,int t) {  int KsocketSelect0(int fd,int t) {
   fd_set readfds;    fd_set readfds;
   struct timeval timeout;    struct timeval timeout;
   extern int errno;  
   FD_ZERO(&readfds);    FD_ZERO(&readfds);
   FD_SET(fd,&readfds);    FD_SET(fd,&readfds);
   timeout.tv_sec = 0;    timeout.tv_sec = 0;
Line 294  struct object KsocketSelectMulti(struct object obj) 
Line 301  struct object KsocketSelectMulti(struct object obj) 
   int size,i,fd,p,t;    int size,i,fd,p,t;
   fd_set readfds;    fd_set readfds;
   struct timeval timeout;    struct timeval timeout;
   extern errno;  
   if (obj.tag != Sarray) {    if (obj.tag != Sarray) {
     errorMsg1s("KsocketSelectMulti([[sid1, sid2,...] optional integer timeout default 0]");      errorMsg1s("KsocketSelectMulti([[sid1, sid2,...] optional integer timeout default 0]");
   }    }
Line 405  struct object KsocketRead(struct object obj) {
Line 411  struct object KsocketRead(struct object obj) {
         errorMsg1s("Select returns 1, but there is no data to read.");          errorMsg1s("Select returns 1, but there is no data to read.");
       }        }
     }else { /* increase the datasize */      }else { /* increase the datasize */
       tmp = (char *)GC_malloc(sizeof(char)*2*datasize);        tmp = (char *)sGC_malloc(sizeof(char)*2*datasize);
       /*I should use GC_malloc_atomic and free after finishing this function?*/        /*I should use sGC_malloc_atomic and free after finishing this function?*/
       if (tmp == (char *)NULL) errorMsg1s("Out of Memory.");        if (tmp == (char *)NULL) errorMsg1s("Out of Memory.");
       bcopy(data,tmp,totalsize);        bcopy(data,tmp,totalsize);
       data = tmp;        data = tmp;
Line 414  struct object KsocketRead(struct object obj) {
Line 420  struct object KsocketRead(struct object obj) {
     }      }
   }    }
   
   r = (char *)GC_malloc(sizeof(char)*(totalsize+1));    r = (char *)sGC_malloc(sizeof(char)*(totalsize+1));
   if (r == (char *)NULL) errorMsg1s("Out of Memory.");    if (r == (char *)NULL) errorMsg1s("Out of Memory.");
   bcopy(data,r,totalsize);    bcopy(data,r,totalsize);
   r[totalsize] = 0;    r[totalsize] = 0;
Line 676  struct object KsocketReadHTTP(struct object socketObj)
Line 682  struct object KsocketReadHTTP(struct object socketObj)
           }            }
         }          }
         if (datasize-1 <= strlen(sss)+strlen(s)) {          if (datasize-1 <= strlen(sss)+strlen(s)) {
       tmp = (char *)GC_malloc(sizeof(char)*2*(datasize+strlen(s))+1);        tmp = (char *)sGC_malloc(sizeof(char)*2*(datasize+strlen(s))+1);
       if (tmp == (char *)NULL) errorMsg1s("Out of Memory.");        if (tmp == (char *)NULL) errorMsg1s("Out of Memory.");
           strcpy(tmp,sss);            strcpy(tmp,sss);
           strcat(tmp,s);            strcat(tmp,s);
Line 780  struct object KsocketGetHostName(void) {
Line 786  struct object KsocketGetHostName(void) {
   if (gethostname(name,1023) != 0) {    if (gethostname(name,1023) != 0) {
     return rob;      return rob;
   }    }
   s = (char *)GC_malloc(sizeof(char)*(strlen(name)+2));    s = (char *)sGC_malloc(sizeof(char)*(strlen(name)+2));
   if (s == (char *)NULL) errorMsg1s("Out of Memory.");    if (s == (char *)NULL) errorMsg1s("Out of Memory.");
   strcpy(s,name);    strcpy(s,name);
   return(KpoString(s));    return(KpoString(s));

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.17

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>