Преглед на файлове

Merge github.com:grpc/grpc into fuzzy-bits

Craig Tiller преди 9 години
родител
ревизия
7b715064e4
променени са 5 файла, в които са добавени 23 реда и са изтрити 18 реда
  1. 12 11
      src/core/iomgr/tcp_server_posix.c
  2. 1 0
      src/core/iomgr/udp_server.c
  3. 6 3
      src/core/surface/init.c
  4. 2 2
      src/python/grpcio/grpc/_links/service.py
  5. 2 2
      src/python/grpcio/grpc/beta/_server.py

+ 12 - 11
src/core/iomgr/tcp_server_posix.c

@@ -486,7 +486,6 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr,
     /* If we didn't get a dualstack socket, also listen on 0.0.0.0. */
     if (port == 0 && sp != NULL) {
       grpc_sockaddr_set_port((struct sockaddr *)&wild4, sp->port);
-      sp2 = sp;
     }
     addr = (struct sockaddr *)&wild4;
     addr_len = sizeof(wild4);
@@ -495,16 +494,18 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr,
   fd = grpc_create_dualstack_socket(addr, SOCK_STREAM, 0, &dsmode);
   if (fd < 0) {
     gpr_log(GPR_ERROR, "Unable to create socket: %s", strerror(errno));
-  }
-  if (dsmode == GRPC_DSMODE_IPV4 &&
-      grpc_sockaddr_is_v4mapped(addr, &addr4_copy)) {
-    addr = (struct sockaddr *)&addr4_copy;
-    addr_len = sizeof(addr4_copy);
-  }
-  sp = add_socket_to_server(s, fd, addr, addr_len, port_index, fd_index);
-  if (sp2 != NULL && sp != NULL) {
-    sp2->sibling = sp;
-    sp->is_sibling = 1;
+  } else {
+    if (dsmode == GRPC_DSMODE_IPV4 &&
+        grpc_sockaddr_is_v4mapped(addr, &addr4_copy)) {
+      addr = (struct sockaddr *)&addr4_copy;
+      addr_len = sizeof(addr4_copy);
+    }
+    sp2 = sp;
+    sp = add_socket_to_server(s, fd, addr, addr_len, port_index, fd_index);
+    if (sp2 != NULL && sp != NULL) {
+      sp2->sibling = sp;
+      sp->is_sibling = 1;
+    }
   }
 
 done:

+ 1 - 0
src/core/iomgr/udp_server.c

@@ -61,6 +61,7 @@
 #include "src/core/iomgr/socket_utils_posix.h"
 #include "src/core/iomgr/unix_sockets_posix.h"
 #include "src/core/support/string.h"
+#include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>

+ 6 - 3
src/core/surface/init.c

@@ -89,18 +89,21 @@ static void do_basic_init(void) {
 }
 
 static bool append_filter(grpc_channel_stack_builder *builder, void *arg) {
-  return grpc_channel_stack_builder_append_filter(builder, arg, NULL, NULL);
+  return grpc_channel_stack_builder_append_filter(
+      builder, (const grpc_channel_filter *)arg, NULL, NULL);
 }
 
 static bool prepend_filter(grpc_channel_stack_builder *builder, void *arg) {
-  return grpc_channel_stack_builder_prepend_filter(builder, arg, NULL, NULL);
+  return grpc_channel_stack_builder_prepend_filter(
+      builder, (const grpc_channel_filter *)arg, NULL, NULL);
 }
 
 static bool maybe_add_http_filter(grpc_channel_stack_builder *builder,
                                   void *arg) {
   grpc_transport *t = grpc_channel_stack_builder_get_transport(builder);
   if (t && strstr(t->vtable->name, "http")) {
-    return grpc_channel_stack_builder_prepend_filter(builder, arg, NULL, NULL);
+    return grpc_channel_stack_builder_prepend_filter(
+        builder, (const grpc_channel_filter *)arg, NULL, NULL);
   }
   return true;
 }

+ 2 - 2
src/python/grpcio/grpc/_links/service.py

@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -177,7 +177,7 @@ class _Kernel(object):
     call = service_acceptance.call
     call.accept(self._completion_queue, call)
     try:
-      group, method = service_acceptance.method.split('/')[1:3]
+      group, method = service_acceptance.method.split(b'/')[1:3]
     except ValueError:
       logging.info('Illegal path "%s"!', service_acceptance.method)
       return

+ 2 - 2
src/python/grpcio/grpc/beta/_server.py

@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -62,7 +62,7 @@ class _GRPCServicer(base.Servicer):
       if e.code is None and e.details is None:
         raise base.NoSuchMethodError(
             interfaces.StatusCode.UNIMPLEMENTED,
-            b'Method "%s" of service "%s" not implemented!' % (method, group))
+            'Method "%s" of service "%s" not implemented!' % (method, group))
       else:
         raise