projects
/
my-code
/
api.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
97756a0
)
fixed network api bug! added MTU for send and receive (look at src)
author
hackbard
<hackbard>
Tue, 16 Nov 2004 10:33:45 +0000
(10:33 +0000)
committer
hackbard
<hackbard>
Tue, 16 Nov 2004 10:33:45 +0000
(10:33 +0000)
network/network.c
patch
|
blob
|
history
network/network.h
patch
|
blob
|
history
diff --git
a/network/network.c
b/network/network.c
index
dc5164b
..
0862637
100644
(file)
--- a/
network/network.c
+++ b/
network/network.c
@@
-255,7
+255,7
@@
int network_send(int fd,unsigned char *data,int datasize) {
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;
}
@@
-278,7
+278,7
@@
int network_receive(int fd,unsigned char *data,int datasize) {
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;
}
diff --git
a/network/network.h
b/network/network.h
index
4f5e87e
..
e80995d
100644
(file)
--- a/
network/network.h
+++ b/
network/network.h
@@
-43,6
+43,8
@@
#define MAX_LISTEN_QUEUE 32
+#define MTU 1448
+
/* net specific variables */
typedef struct s_connection {
int fd;