@@ -40,7 +40,7 @@ static lf_ret_t S4NOCPollChannel_send_blocking(NetworkChannel *untyped_self, con
4040
4141 if (self -> state == NETWORK_CHANNEL_STATE_CONNECTED ) {
4242 int message_size = serialize_to_protobuf (message , self -> write_buffer + 4 , S4NOC_CHANNEL_BUFFERSIZE - 4 );
43-
43+
4444 * ((int * )self -> write_buffer ) = message_size ;
4545
4646 int total_size = message_size + 4 ;
@@ -83,31 +83,31 @@ void S4NOCPollChannel_poll(NetworkChannel *untyped_self) {
8383
8484 int value = * s4noc_data ;
8585 int source = * s4noc_source ;
86- S4NOC_CHANNEL_INFO ("S4NOCPollChannel_poll: Received value 0x%08x (%c%c%c%c) from source %d" , value ,
87- ((char * )& value )[0 ], ((char * )& value )[1 ], ((char * )& value )[2 ], ((char * )& value )[3 ], source );
88- S4NOCPollChannel * receive_channel = s4noc_global_state .core_channels [source ][get_cpuid ()]; // Get the receive channel for the source core
86+ S4NOC_CHANNEL_INFO ("S4NOCPollChannel_poll: Received value 0x%08x (%c%c%c%c) from source %d" , value ,
87+ ((char * )& value )[0 ], ((char * )& value )[1 ], ((char * )& value )[2 ], ((char * )& value )[3 ], source );
88+ S4NOCPollChannel * receive_channel =
89+ s4noc_global_state .core_channels [source ][get_cpuid ()]; // Get the receive channel for the source core
8990
9091 ((int * )receive_channel -> receive_buffer )[receive_channel -> receive_buffer_index / 4 ] = value ;
9192 receive_channel -> receive_buffer_index += 4 ;
9293 S4NOC_CHANNEL_DEBUG ("receive_buffer_index %d" , receive_channel -> receive_buffer_index );
9394 unsigned int expected_message_size = * ((int * )receive_channel -> receive_buffer );
9495 S4NOC_CHANNEL_DEBUG ("Expected message size: %d" , expected_message_size );
9596 if (receive_channel -> receive_buffer_index >= expected_message_size + 4 ) {
96- int bytes_left = deserialize_from_protobuf (
97- & receive_channel -> output ,
98- receive_channel -> receive_buffer + 4 , // skip the 4-byte size header
99- expected_message_size // only the message payload
97+ int bytes_left = deserialize_from_protobuf (& receive_channel -> output ,
98+ receive_channel -> receive_buffer + 4 , // skip the 4-byte size header
99+ expected_message_size // only the message payload
100100 );
101101 S4NOC_CHANNEL_DEBUG ("Bytes Left after attempted to deserialize: %d" , bytes_left );
102102
103103 if (bytes_left >= 0 ) {
104- receive_channel -> receive_buffer_index = bytes_left ;
105- if (receive_channel -> receive_callback != NULL ) {
106- S4NOC_CHANNEL_DEBUG ("calling user callback at %p!" , receive_channel -> receive_callback );
107- receive_channel -> receive_callback (self -> federated_connection , & receive_channel -> output );
108- } else {
109- S4NOC_CHANNEL_WARN ("No receive callback registered, dropping message" );
110- }
104+ receive_channel -> receive_buffer_index = bytes_left ;
105+ if (receive_channel -> receive_callback != NULL ) {
106+ S4NOC_CHANNEL_DEBUG ("calling user callback at %p!" , receive_channel -> receive_callback );
107+ receive_channel -> receive_callback (self -> federated_connection , & receive_channel -> output );
108+ } else {
109+ S4NOC_CHANNEL_WARN ("No receive callback registered, dropping message" );
110+ }
111111 }
112112 }
113113}
@@ -132,5 +132,5 @@ void S4NOCPollChannel_ctor(S4NOCPollChannel *self, Environment *env, unsigned in
132132 self -> receive_callback = NULL ;
133133 self -> federated_connection = NULL ;
134134 self -> state = NETWORK_CHANNEL_STATE_CONNECTED ;
135- self -> destination_core = destination_core ;
135+ self -> destination_core = destination_core ;
136136}
0 commit comments