If you just need to have access to the net.Conn, you don't need to change 
the grpc lib.

What I mean is something like:

type listenerWrapper struct {
net.Listener
}

func (l *listenerWrapper) Accept() (net.Conn, error) {
c, err := l.Listener.Accept()
if err == nil {
*// Do something to the net.Conn.*
}
return c, err
}

func main() {
lis, err := net.Listen("tcp", port)
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
s := grpc.NewServer()
pb.RegisterGreeterServer(s, &server{})
s.Serve(&listenerWrapper{lis})     *// Use the listener wrapper.*
}


On Wednesday, April 26, 2017 at 1:07:06 PM UTC-7, Steven Jiang wrote:
>
> I'm using go/1.6.2 + grpc 1.0.
>
> Do I have to change grpc lib? I mean, is there any way to set TOS bits of 
> a grpc server stream without changing grpc lib itself?
> If changing grpc lib can't be avoided, what's the best way to do it? How 
> to pass the TOS value from app layer into grpc lib?
>
>
> Thanks
> Steven
>
> On Wednesday, April 26, 2017 at 10:47:28 AM UTC-7, Menghan Li wrote:
>>
>> net.Listener is an interface. You could wrap the listener, override the 
>> Accept(), and set the TOS bit there.
>>
>> On Tuesday, April 18, 2017 at 4:30:24 PM UTC-7, Steven Jiang wrote:
>>>
>>> grpc server is listening on a port and accepting connection request from 
>>> grpc clients.  lis.Accept() is called inside grpc lib. If I'd like to set 
>>> TOS bits of the new accepted connection, what should I do?
>>>
>>> Thanks
>>> Steven
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/4c8d8ee8-5007-47c2-8295-027301815eb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to