@@ -167,7 +167,7 @@ PROCESS_THREAD(udp_socket_process, ev, data)
167
167
168
168
/* If we were called because of incoming data, we should call
169
169
the reception callback. */
170
- if (uip_newdata ()) {
170
+ if (uip_newdata () && c -> input_callback != NULL ) {
171
171
/* Copy the data from the uIP data buffer into our own
172
172
buffer to avoid the uIP buffer being messed with by the
173
173
callee. */
@@ -176,16 +176,14 @@ PROCESS_THREAD(udp_socket_process, ev, data)
176
176
/* Call the client process. We use the PROCESS_CONTEXT
177
177
mechanism to temporarily switch process context to the
178
178
client process. */
179
- if (c -> input_callback != NULL ) {
180
- PROCESS_CONTEXT_BEGIN (c -> p );
181
- c -> input_callback (c , c -> ptr ,
182
- & (UIP_IP_BUF -> srcipaddr ),
183
- UIP_HTONS (UIP_UDP_BUF -> srcport ),
184
- & (UIP_IP_BUF -> destipaddr ),
185
- UIP_HTONS (UIP_UDP_BUF -> destport ),
186
- buf , uip_datalen ());
187
- PROCESS_CONTEXT_END ();
188
- }
179
+ PROCESS_CONTEXT_BEGIN (c -> p );
180
+ c -> input_callback (c , c -> ptr ,
181
+ & (UIP_IP_BUF -> srcipaddr ),
182
+ UIP_HTONS (UIP_UDP_BUF -> srcport ),
183
+ & (UIP_IP_BUF -> destipaddr ),
184
+ UIP_HTONS (UIP_UDP_BUF -> destport ),
185
+ buf , uip_datalen ());
186
+ PROCESS_CONTEXT_END ();
189
187
}
190
188
}
191
189
}
0 commit comments