@@ -64,11 +64,6 @@ func (d *Device) GetHostByName(name string) (netip.Addr, error) {
6464}
6565
6666func (d * Device ) Socket (domain int , stype int , protocol int ) (int , error ) {
67- if debugging (debugNetdev ) {
68- fmt .Printf ("[Socket] domain: %d, type: %d, protocol: %d\r \n " ,
69- domain , stype , protocol )
70- }
71-
7267 if domain != netdev .AF_INET {
7368 return - 1 , netdev .ErrFamilyNotSupported
7469 }
@@ -108,10 +103,6 @@ func (d *Device) openSocket(sockn uint8, proto byte) {
108103}
109104
110105func (d * Device ) Bind (sockfd int , ip netip.AddrPort ) error {
111- if debugging (debugNetdev ) {
112- fmt .Printf ("[Bind] sockfd: %d, addr: %s:%d\r \n " , sockfd , ip .Addr (), ip .Port ())
113- }
114-
115106 // The IP address is irrelevant. The configured ip will always be used.
116107 port := ip .Port ()
117108 if port < 1 || port > 65535 {
@@ -154,14 +145,6 @@ func (d *Device) SetSockOpt(int, int, int, any) error {
154145// If the host is an empty string, it will use the provided ip address and port,
155146// otherwise it will resolve the host name to an IP address.
156147func (d * Device ) Connect (sockfd int , host string , ip netip.AddrPort ) error {
157- if debugging (debugNetdev ) {
158- if host == "" {
159- fmt .Printf ("[Connect] sockfd: %d, addr: %s\r \n " , sockfd , ip )
160- } else {
161- fmt .Printf ("[Connect] sockfd: %d, host: %s:%d\r \n " , sockfd , host , ip .Port ())
162- }
163- }
164-
165148 destIP := ip .Addr ()
166149 if host != "" {
167150 var err error
@@ -196,10 +179,6 @@ func (d *Device) Connect(sockfd int, host string, ip netip.AddrPort) error {
196179//
197180// The backlog parameter is ignored, as the W5500 does not support it.
198181func (d * Device ) Listen (sockfd int , _ int ) error {
199- if debugging (debugNetdev ) {
200- fmt .Printf ("[Listen] sockfd: %d\r \n " , sockfd )
201- }
202-
203182 d .mu .Lock ()
204183 defer d .mu .Unlock ()
205184
@@ -229,10 +208,6 @@ func (d *Device) listen(sockn uint8) error {
229208
230209// Accept waits for an incoming connection on the specified socket file descriptor.
231210func (d * Device ) Accept (sockfd int ) (int , netip.AddrPort , error ) {
232- if debugging (debugNetdev ) {
233- fmt .Printf ("[Accept] sockfd: %d\r \n " , sockfd )
234- }
235-
236211 d .mu .Lock ()
237212 defer d .mu .Unlock ()
238213
@@ -264,10 +239,6 @@ func (d *Device) Accept(sockfd int) (int, netip.AddrPort, error) {
264239
265240 csock .setInUse (true )
266241
267- if debugging (debugNetdev ) {
268- fmt .Printf ("[Accepted] sockfd: %d\r \n " , csockfd )
269- }
270-
271242 remoteIP := d .remoteIP (csock .sockn )
272243 return csockfd , remoteIP , nil
273244}
@@ -306,11 +277,6 @@ func (d *Device) remoteIP(sockn uint8) netip.AddrPort {
306277// Send sends data to the socket with the given file descriptor.
307278// It blocks until all data is sent or the deadline is reached.
308279func (d * Device ) Send (sockfd int , buf []byte , _ int , deadline time.Time ) (int , error ) {
309- if debugging (debugNetdev ) {
310- fmt .Printf ("[Send] sockfd: %d, len(buf): %d\r \n " ,
311- sockfd , len (buf ))
312- }
313-
314280 bufLen := len (buf )
315281 if bufLen <= d .maxSockSize {
316282 // Fast path for small buffers.
@@ -399,11 +365,6 @@ func (d *Device) waitForFreeBuffer(sockn uint8, len uint16, deadline time.Time)
399365// Recv reads data from the socket with the given file descriptor into the provided buffer.
400366// It blocks until data is available or the deadline is reached.
401367func (d * Device ) Recv (sockfd int , buf []byte , _ int , deadline time.Time ) (int , error ) {
402- if debugging (debugNetdev ) {
403- fmt .Printf ("[Recv] sockfd: %d, len(buf): %d\r \n " ,
404- sockfd , len (buf ))
405- }
406-
407368 d .mu .Lock ()
408369 defer d .mu .Unlock ()
409370
@@ -450,10 +411,6 @@ func (d *Device) waitForData(sock *socket, deadline time.Time) (int, error) {
450411
451412// Close closes the socket with the given file descriptor.
452413func (d * Device ) Close (sockfd int ) error {
453- if debugging (debugNetdev ) {
454- fmt .Printf ("[Close] sockfd: %d\r \n " , sockfd )
455- }
456-
457414 d .mu .Lock ()
458415 defer d .mu .Unlock ()
459416
0 commit comments