Changeset - 1c075fe042df
[Not reviewed]
default
0 2 0
Nathan Brink (binki) - 15 years ago 2010-07-18 20:54:37
ohnobinki@ohnopublishing.net
Fixed one of the stupidest mistakes one could make when using poll(); I used .events where I needed .revents.
Fixed typo in function name: mulitiio_poll_invoke_handlers() -> multiio_poll_invoke_handlers() and small variable initialization cleanup.
2 files changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/common/multiio.c
Show inline comments
 
@@ -154,17 +154,17 @@ struct multiio_poll_travinfo
 
  struct multiio_socket_info *socket_info;
 
  struct pollfd *pollfd;
 
};
 
/**
 
   list traverser for multiio_poll()
 
 */
 
int mulitiio_poll_invoke_handlers(struct multiio_poll_travinfo *travinfo, struct multiio_socket_type_handler_info *handler_info)
 
int multiio_poll_invoke_handlers(struct multiio_poll_travinfo *travinfo, struct multiio_socket_type_handler_info *handler_info)
 
{
 
  short event;
 

	
 
  event = travinfo->pollfd->events & handler_info->event;
 
  event = travinfo->pollfd->revents & handler_info->event;
 
  if(!event)
 
    return TRUE;
 

	
 
  handler_info->handler(travinfo->multiio,
 
			travinfo->pollfd->fd,
 
			event,
 
@@ -186,13 +186,13 @@ int multiio_poll(multiio_context_t conte
 
      {
 
	travinfo.multiio = context;
 
	travinfo.socket_info = &context->socket_infos[counter];
 
	travinfo.pollfd = &context->pollfds[counter];
 
	list_traverse(context->socket_types[context->socket_infos[counter].socket_type].type_handlers,
 
		      &travinfo,
 
		      (list_traverse_func_t)&mulitiio_poll_invoke_handlers,
 
		      (list_traverse_func_t)&multiio_poll_invoke_handlers,
 
		      LIST_FRNT | LIST_SAVE);
 
      }
 

	
 
  return 0;
 
}
 

	
src/common/remoteio.c
Show inline comments
 
@@ -645,12 +645,13 @@ int _remoteio_sock_close(struct remoteio
 
}
 

	
 
int _remoteio_sock_read(struct remoteio *rem, void *buf, size_t len, size_t *bytesread)
 
{
 
  ssize_t readrtn;
 

	
 
  *bytesread = 0;
 
  readrtn = read(rem->sock, buf, len);
 
  /*
 
    The following is valid for blocking sockets:
 
   */
 
  if(readrtn == -1)
 
    {
 
@@ -658,13 +659,12 @@ int _remoteio_sock_read(struct remoteio 
 
	in this case, we may have been interrupted by a signal and errno == EINTR
 
	or the connection was reset and errno = ECONNRESET
 

	
 
	Some of these are not error conditions:
 
       */
 
      perror("read");
 
      *bytesread = 0;
 

	
 
      if(errno != EINTR)
 
	{
 
	  fprintf(stderr, "error reading socket in remoteio_sock_read\n");
 
	  return 1;
 
	}
0 comments (0 inline, 0 general)