@@ -53,7 +53,6 @@ static timestamp_t oldest_have;
53
53
static unsigned int allow_unadvertised_object_request ;
54
54
static int shallow_nr ;
55
55
static struct object_array extra_edge_obj ;
56
- static int keepalive = 5 ;
57
56
static const char * pack_objects_hook ;
58
57
59
58
static int allow_filter ;
@@ -78,6 +77,7 @@ struct upload_pack_data {
78
77
timestamp_t deepen_since ;
79
78
int deepen_rev_list ;
80
79
int deepen_relative ;
80
+ int keepalive ;
81
81
82
82
unsigned int timeout ; /* v0 only */
83
83
enum {
@@ -125,6 +125,8 @@ static void upload_pack_data_init(struct upload_pack_data *data)
125
125
data -> shallows = shallows ;
126
126
data -> deepen_not = deepen_not ;
127
127
packet_writer_init (& data -> writer , 1 );
128
+
129
+ data -> keepalive = 5 ;
128
130
}
129
131
130
132
static void upload_pack_data_clear (struct upload_pack_data * data )
@@ -253,7 +255,7 @@ static void create_pack_file(struct upload_pack_data *pack_data)
253
255
254
256
while (1 ) {
255
257
struct pollfd pfd [2 ];
256
- int pe , pu , pollsize ;
258
+ int pe , pu , pollsize , polltimeout ;
257
259
int ret ;
258
260
259
261
reset_timeout (pack_data -> timeout );
@@ -277,8 +279,11 @@ static void create_pack_file(struct upload_pack_data *pack_data)
277
279
if (!pollsize )
278
280
break ;
279
281
280
- ret = poll (pfd , pollsize ,
281
- keepalive < 0 ? -1 : 1000 * keepalive );
282
+ polltimeout = pack_data -> keepalive < 0
283
+ ? -1
284
+ : 1000 * pack_data -> keepalive ;
285
+
286
+ ret = poll (pfd , pollsize , polltimeout );
282
287
283
288
if (ret < 0 ) {
284
289
if (errno != EINTR ) {
@@ -1115,6 +1120,8 @@ static int find_symref(const char *refname, const struct object_id *oid,
1115
1120
1116
1121
static int upload_pack_config (const char * var , const char * value , void * cb_data )
1117
1122
{
1123
+ struct upload_pack_data * data = cb_data ;
1124
+
1118
1125
if (!strcmp ("uploadpack.allowtipsha1inwant" , var )) {
1119
1126
if (git_config_bool (var , value ))
1120
1127
allow_unadvertised_object_request |= ALLOW_TIP_SHA1 ;
@@ -1131,9 +1138,9 @@ static int upload_pack_config(const char *var, const char *value, void *cb_data)
1131
1138
else
1132
1139
allow_unadvertised_object_request &= ~ALLOW_ANY_SHA1 ;
1133
1140
} else if (!strcmp ("uploadpack.keepalive" , var )) {
1134
- keepalive = git_config_int (var , value );
1135
- if (!keepalive )
1136
- keepalive = -1 ;
1141
+ data -> keepalive = git_config_int (var , value );
1142
+ if (!data -> keepalive )
1143
+ data -> keepalive = -1 ;
1137
1144
} else if (!strcmp ("uploadpack.allowfilter" , var )) {
1138
1145
allow_filter = git_config_bool (var , value );
1139
1146
} else if (!strcmp ("uploadpack.allowrefinwant" , var )) {
0 commit comments