projects
/
my-code
/
api.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed network api bug! added MTU for send and receive (look at src)
[my-code/api.git]
/
network
/
network.c
diff --git
a/network/network.c
b/network/network.c
index
1cdd38c
..
0862637
100644
(file)
--- a/
network/network.c
+++ b/
network/network.c
@@
-8,7
+8,7
@@
int network_init(t_net *net,int outfd) {
int network_init(t_net *net,int outfd) {
- dprintf(
net->
outfd,"[network] initializing network api ...\n");
+ dprintf(outfd,"[network] initializing network api ...\n");
memset(net->connection,0,MAX_CONNECTIONS*sizeof(t_connection));
net->c_count=0;
memset(net->connection,0,MAX_CONNECTIONS*sizeof(t_connection));
net->c_count=0;
@@
-255,7
+255,7
@@
int network_send(int fd,unsigned char *data,int datasize) {
left=datasize;
while(left) {
left=datasize;
while(left) {
- if((count=write(fd,data+datasize-left,left))==-1) {
+ if((count=write(fd,data+datasize-left,left
<MTU?left:MTU
))==-1) {
perror("[network] write call");
return N_ERROR;
}
perror("[network] write call");
return N_ERROR;
}
@@
-278,7
+278,7
@@
int network_receive(int fd,unsigned char *data,int datasize) {
left=datasize;
while(left) {
left=datasize;
while(left) {
- if((count=read(fd,data
,datasize
))==-1) {
+ if((count=read(fd,data
+datasize-left,left<MTU?left:MTU
))==-1) {
perror("[network] read call");
return N_ERROR;
}
perror("[network] read call");
return N_ERROR;
}