projects
/
my-code
/
ivac.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c0de1cf
)
fixed parsing error & detect broken pipes
author
hackbard
<hackbard>
Wed, 12 May 2004 16:52:10 +0000
(16:52 +0000)
committer
hackbard
<hackbard>
Wed, 12 May 2004 16:52:10 +0000
(16:52 +0000)
src/ivac.c
patch
|
blob
|
history
diff --git
a/src/ivac.c
b/src/ivac.c
index
56a687f
..
49fc97d
100644
(file)
--- a/
src/ivac.c
+++ b/
src/ivac.c
@@
-60,10
+60,10
@@
int main(int argc,char **argv) {
usage();
break;
case 'n':
usage();
break;
case 'n':
- strncpy(ivac.username,argv[
i+1
],CHAR_USERNAME);
+ strncpy(ivac.username,argv[
++i
],CHAR_USERNAME);
break;
case 'p':
break;
case 'p':
- ivac.net.l_port=atoi(argv[
i+1
]);
+ ivac.net.l_port=atoi(argv[
++i
]);
break;
default:
usage();
break;
default:
usage();
@@
-229,7
+229,7
@@
int ivac_receive_info(int channel,t_ivac *ivac) {
}
}
}
}
- return
SUCCESS
;
+ return
length
;
}
int ivac_event_cb(t_event *event,void *ptr) {
}
int ivac_event_cb(t_event *event,void *ptr) {
@@
-263,7
+263,12
@@
int ivac_event_cb(t_event *event,void *ptr) {
if(ivac->net.connection[channel].status&C_ESTABL) {
/* remote is sending info */
if(FD_ISSET(ivac->net.connection[channel].fd,&(event->rfds))) {
if(ivac->net.connection[channel].status&C_ESTABL) {
/* remote is sending info */
if(FD_ISSET(ivac->net.connection[channel].fd,&(event->rfds))) {
- ivac_receive_info(channel,ivac);
+ if(ivac_receive_info(channel,ivac)==0) {
+ event_math(ivac->net.connection[channel].fd,event,READ,REMOVE);
+ network_close(&(ivac->net),channel);
+ sprintf(c_str,"channel %02d: broken pipe - disconnected",channel);
+ ivac_add_to_monitor(ivac,c_str);
+ }
ivac_display_content(ivac);
}
}
ivac_display_content(ivac);
}
}