@@ -85,23 +85,21 @@ JUICE_EXPORT int juice_set_remote_gathering_done(juice_agent_t *agent) {
8585}
8686
8787JUICE_EXPORT  int  juice_send (juice_agent_t  * agent , const  char  * data , size_t  size ) {
88- 	if  (!agent  ||  (!data  &&  size ))
89- 		return  JUICE_ERR_INVALID ;
90- 
91- 	if  (agent_send (agent , data , size , 0 ) <  0 )
92- 		return  JUICE_ERR_FAILED ;
93- 
94- 	return  JUICE_ERR_SUCCESS ;
88+ 	return  juice_send_diffserv (agent , data , size , 0 );
9589}
9690
9791JUICE_EXPORT  int  juice_send_diffserv (juice_agent_t  * agent , const  char  * data , size_t  size , int  ds ) {
9892	if  (!agent  ||  (!data  &&  size ))
9993		return  JUICE_ERR_INVALID ;
10094
101- 	if  (agent_send (agent , data , size , ds ) <  0 )
102- 		return  JUICE_ERR_FAILED ;
103- 
104- 	return  JUICE_ERR_SUCCESS ;
95+ 	int  ret  =  agent_send (agent , data , size , ds );
96+ 	if (ret  >= 0 )
97+ 		return  JUICE_ERR_SUCCESS ;
98+ 	if (ret  ==  - SEAGAIN  ||  ret  ==  - SEWOULDBLOCK )
99+ 		return  JUICE_ERR_AGAIN ;
100+ 	if (ret  ==  - SEMSGSIZE )
101+ 		return  JUICE_ERR_TOO_LARGE ;
102+ 	return  JUICE_ERR_FAILED ;
105103}
106104
107105JUICE_EXPORT  juice_state_t  juice_get_state (juice_agent_t  * agent ) { return  agent_get_state (agent ); }
0 commit comments