call site 6 for execnet.Channel.send
execnet/testing/test_rsync.py - line 38
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
   def test_dirsync(self):
       dest = self.dest1
       dest2 = self.dest2
       source = self.source
   
       for s in ('content1', 'content2-a-bit-longer'): 
           source.ensure('subdir', 'file1').write(s) 
           rsync = RSync(self.source)
           rsync.add_target(gw, dest)
           rsync.add_target(gw2, dest2)
->         rsync.send()
           assert dest.join('subdir').check(dir=1)
           assert dest.join('subdir', 'file1').check(file=1)
           assert dest.join('subdir', 'file1').read() == s 
           assert dest2.join('subdir').check(dir=1)
           assert dest2.join('subdir', 'file1').check(file=1)
           assert dest2.join('subdir', 'file1').read() == s 
           
       source.join('subdir').remove('file1')
       rsync = RSync(source)
       rsync.add_target(gw2, dest2)
       rsync.add_target(gw, dest)
       rsync.send()
       assert dest.join('subdir', 'file1').check(file=1)
       assert dest2.join('subdir', 'file1').check(file=1)
       rsync = RSync(source)
       rsync.add_target(gw, dest, delete=True)
       rsync.add_target(gw2, dest2)
       rsync.send()
       assert not dest.join('subdir', 'file1').check() 
       assert dest2.join('subdir', 'file1').check() 
execnet/rsync.py - line 126
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
   def send(self, raises=True):
       """ Sends a sourcedir to all added targets. Flag indicates
           whether to raise an error or return in case of lack of
           targets
           """
       if not self._channels:
           if raises:
               raise IOError("no targets available, maybe you "
                             "are trying call send() twice?")
           return
       # normalize a trailing '/' away
       self._sourcedir = os.path.dirname(os.path.join(self._sourcedir, 'x'))
       # send directory structure and file timestamps/sizes
       self._send_directory_structure(self._sourcedir)
   
       # paths and to_send are only used for doing
       # progress-related callbacks
       self._paths = {}
       self._to_send = {}
   
       # send modified file to clients
       while self._channels:
           channel, req = self._receivequeue.get()
           if req is None:
               self._end_of_channel(channel)
           else:
               command, data = req
               if command == "links":
                   self._process_link(channel)
               elif command == "done":
                   self._done(channel)
               elif command == "ack":
                   if self._callback:
                       self._callback("ack", self._paths[data], channel)
               elif command == "list_done":
                   self._list_done(channel)
               elif command == "send":
->                 self._send_item(channel, data)
                   del data
               else:
                   assert "Unknown command %s" % command
execnet/rsync.py - line 83
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
   def _send_item(self, channel, data):
       """ Send one item
           """
       modified_rel_path, checksum = data
       modifiedpath = os.path.join(self._sourcedir, *modified_rel_path)
       try:
           f = open(modifiedpath, 'rb')
           data = f.read()
       except IOError:
           data = None
   
       # provide info to progress callback function
       modified_rel_path = "/".join(modified_rel_path)
       if data is not None:
           self._paths[modified_rel_path] = len(data)
       else:
           self._paths[modified_rel_path] = 0
       if channel not in self._to_send:
           self._to_send[channel] = []
       self._to_send[channel].append(modified_rel_path)
   
       if data is not None:
           f.close()
           if checksum is not None and checksum == md5.md5(data).digest():
               data = None     # not really modified
           else:
               # ! there is a reason for the interning:
               # sharing multiple copies of the file's data
               data = intern(data)
               self._report_send_file(channel.gateway, modified_rel_path)
->     channel.send(data)